From 87519cd26f0174ce273fc63ee40076bb02132a22 Mon Sep 17 00:00:00 2001 From: beholder Date: Fri, 10 Nov 2017 19:39:51 +0300 Subject: [PATCH] use conditional bindings to avoid intermediate binding states --- .../qml/hifi/tablet/TabletMenuItem.qml | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/interface/resources/qml/hifi/tablet/TabletMenuItem.qml b/interface/resources/qml/hifi/tablet/TabletMenuItem.qml index 11d3cab35e..520841b33f 100644 --- a/interface/resources/qml/hifi/tablet/TabletMenuItem.qml +++ b/interface/resources/qml/hifi/tablet/TabletMenuItem.qml @@ -40,37 +40,29 @@ Item { CheckBox { id: checkbox - // FIXME: Should use radio buttons if source.exclusiveGroup. + width: 20 visible: source !== null ? source.visible && source.type === 1 && source.checkable && !source.exclusiveGroup : false - checked: setChecked() - function setChecked() { - if (!source || source.type !== 1 || !source.checkable) { - return false; - } - // FIXME this works for native QML menus but I don't think it will - // for proxied QML menus - return source.checked; + + Binding on checked { + value: source.checked; + when: source && source.type === 1 && source.checkable && !source.exclusiveGroup; } } RadioButton { id: radiobutton - // FIXME: Should use radio buttons if source.exclusiveGroup. + width: 20 visible: source !== null ? source.visible && source.type === 1 && source.checkable && source.exclusiveGroup : false - checked: setChecked() - function setChecked() { - if (!source || source.type !== 1 || !source.checkable) { - return false; - } - // FIXME this works for native QML menus but I don't think it will - // for proxied QML menus - return source.checked; + + Binding on checked { + value: source.checked; + when: source && source.type === 1 && source.checkable && source.exclusiveGroup; } } }