Style checkbox for menu items

This commit is contained in:
David Rowe 2016-03-11 15:51:27 +13:00
parent fb0f97264c
commit e175c19754
2 changed files with 12 additions and 18 deletions

View file

@ -26,31 +26,25 @@ Item {
visible: source.visible visible: source.visible
width: parent.width width: parent.width
FontAwesome { CheckBox {
clip: true
id: check id: check
verticalAlignment: Text.AlignVCenter // FIXME: Shouild use radio buttons if source.exclusiveGroup.
anchors { anchors {
verticalCenter: parent.verticalCenter
left: parent.left left: parent.left
leftMargin: hifi.dimensions.menuPadding.x leftMargin: hifi.dimensions.menuPadding.x
top: label.top
topMargin: 0
} }
width: 1.5 * hifi.dimensions.menuPadding.x width: 20
color: label.color visible: source.visible && source.type === 1 && source.checkable
text: checkText() checked: setChecked()
size: label.height function setChecked() {
visible: source.visible
font.pixelSize: size
function checkText() {
if (!source || source.type !== 1 || !source.checkable) { if (!source || source.type !== 1 || !source.checkable) {
return "" return false;
} }
// FIXME this works for native QML menus but I don't think it will // FIXME this works for native QML menus but I don't think it will
// for proxied QML menus // for proxied QML menus
if (source.exclusiveGroup) { return source.checked;
return source.checked ? "\uF05D" : "\uF10C"
}
return source.checked ? "\uF046" : "\uF096"
} }
} }
@ -69,7 +63,7 @@ Item {
Item { Item {
// Space for shortcut key or disclosure icon. // Space for shortcut key or disclosure icon.
id: tail id: tail
width: 4 * hifi.dimensions.menuPadding.x width: 48
anchors { anchors {
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
right: parent.right right: parent.right

View file

@ -138,7 +138,7 @@ Item {
readonly property real modalDialogTitleHeight: 40 readonly property real modalDialogTitleHeight: 40
readonly property real controlLineHeight: 29 // Height of spinbox control on 1920 x 1080 monitor readonly property real controlLineHeight: 29 // Height of spinbox control on 1920 x 1080 monitor
readonly property real controlInterlineHeight: 22 // 75% of controlLineHeight 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 { Item {