Details
-
Bug
-
Resolution: Duplicate
-
P2: Important
-
None
-
5.6.1
-
None
Description
import QtQuick 2.4 Rectangle { width: 400 height: 500 anchors.fill: parent color: "red" Binding on color { when: ma.pressed value: ma.mouseX % 2 ? "green" : "blue" } MouseArea { id: ma anchors.fill: parent } }
According Binding type docs:
In some cases you may want to modify the value of a property when a certain condition is met but leave it unmodified otherwise. Often, it's not possible to do this with direct bindings, as you have to supply values for all possible branches.
[...]
The Binding type restores any previously set direct bindings on the property.
Now I know that in my case it's not properly a binding, but a static value in fact setting color: { "red" } would make this to work, but I was expecting the binding to be completely set back to the "default" value (or to the component customer-set value) once invalid.
Attachments
Issue Links
- duplicates
-
QTBUG-33444 Binding does not restore original property value if it was assigned as a constant
-
- Closed
-