From e175c1975464fe3a22fbf46b5509ca7ecc42f0d2 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 11 Mar 2016 15:51:27 +1300 Subject: [PATCH] Style checkbox for menu items --- interface/resources/qml/menus/VrMenuItem.qml | 28 ++++++++----------- .../qml/styles-uit/HifiConstants.qml | 2 +- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/interface/resources/qml/menus/VrMenuItem.qml b/interface/resources/qml/menus/VrMenuItem.qml index f2c077a59e..636728c890 100644 --- a/interface/resources/qml/menus/VrMenuItem.qml +++ b/interface/resources/qml/menus/VrMenuItem.qml @@ -26,31 +26,25 @@ Item { visible: source.visible width: parent.width - FontAwesome { - clip: true + CheckBox { id: check - verticalAlignment: Text.AlignVCenter + // FIXME: Shouild use radio buttons if source.exclusiveGroup. anchors { - verticalCenter: parent.verticalCenter left: parent.left leftMargin: hifi.dimensions.menuPadding.x + top: label.top + topMargin: 0 } - width: 1.5 * hifi.dimensions.menuPadding.x - color: label.color - text: checkText() - size: label.height - visible: source.visible - font.pixelSize: size - function checkText() { + width: 20 + visible: source.visible && source.type === 1 && source.checkable + checked: setChecked() + function setChecked() { if (!source || source.type !== 1 || !source.checkable) { - return "" + return false; } // FIXME this works for native QML menus but I don't think it will // for proxied QML menus - if (source.exclusiveGroup) { - return source.checked ? "\uF05D" : "\uF10C" - } - return source.checked ? "\uF046" : "\uF096" + return source.checked; } } @@ -69,7 +63,7 @@ Item { Item { // Space for shortcut key or disclosure icon. id: tail - width: 4 * hifi.dimensions.menuPadding.x + width: 48 anchors { verticalCenter: parent.verticalCenter right: parent.right diff --git a/interface/resources/qml/styles-uit/HifiConstants.qml b/interface/resources/qml/styles-uit/HifiConstants.qml index 3b6eb2d9fc..718c1e32cb 100644 --- a/interface/resources/qml/styles-uit/HifiConstants.qml +++ b/interface/resources/qml/styles-uit/HifiConstants.qml @@ -138,7 +138,7 @@ Item { readonly property real modalDialogTitleHeight: 40 readonly property real controlLineHeight: 29 // Height of spinbox control on 1920 x 1080 monitor readonly property real controlInterlineHeight: 22 // 75% of controlLineHeight - readonly property vector2d menuPadding: Qt.vector2d(12, 12) + readonly property vector2d menuPadding: Qt.vector2d(14, 12) } Item {