mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 23:17:02 +02:00
use conditional bindings to avoid intermediate binding states
This commit is contained in:
parent
908faa1334
commit
87519cd26f
1 changed files with 10 additions and 18 deletions
|
@ -40,37 +40,29 @@ Item {
|
||||||
|
|
||||||
CheckBox {
|
CheckBox {
|
||||||
id: checkbox
|
id: checkbox
|
||||||
// FIXME: Should use radio buttons if source.exclusiveGroup.
|
|
||||||
width: 20
|
width: 20
|
||||||
visible: source !== null ?
|
visible: source !== null ?
|
||||||
source.visible && source.type === 1 && source.checkable && !source.exclusiveGroup :
|
source.visible && source.type === 1 && source.checkable && !source.exclusiveGroup :
|
||||||
false
|
false
|
||||||
checked: setChecked()
|
|
||||||
function setChecked() {
|
Binding on checked {
|
||||||
if (!source || source.type !== 1 || !source.checkable) {
|
value: source.checked;
|
||||||
return false;
|
when: source && source.type === 1 && source.checkable && !source.exclusiveGroup;
|
||||||
}
|
|
||||||
// FIXME this works for native QML menus but I don't think it will
|
|
||||||
// for proxied QML menus
|
|
||||||
return source.checked;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RadioButton {
|
RadioButton {
|
||||||
id: radiobutton
|
id: radiobutton
|
||||||
// FIXME: Should use radio buttons if source.exclusiveGroup.
|
|
||||||
width: 20
|
width: 20
|
||||||
visible: source !== null ?
|
visible: source !== null ?
|
||||||
source.visible && source.type === 1 && source.checkable && source.exclusiveGroup :
|
source.visible && source.type === 1 && source.checkable && source.exclusiveGroup :
|
||||||
false
|
false
|
||||||
checked: setChecked()
|
|
||||||
function setChecked() {
|
Binding on checked {
|
||||||
if (!source || source.type !== 1 || !source.checkable) {
|
value: source.checked;
|
||||||
return false;
|
when: source && source.type === 1 && source.checkable && source.exclusiveGroup;
|
||||||
}
|
|
||||||
// FIXME this works for native QML menus but I don't think it will
|
|
||||||
// for proxied QML menus
|
|
||||||
return source.checked;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue