Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.13.1
-
-
d522746afa394960bef225ba08080d8364b69a7e (qt/qtdeclarative/5.15)
Description
Regarding BindingSilentBreak:
If you assign a value to a property that has a binding, qt.qml.binding.removal.debug=true will print a warning.
However if you are using Binding QML type, the same is not true - the Binding silently stops working without warning.
See attached very simple demo. Press each button to break the binding with an assignment. One binding using the most optimal binding expression and warns when broken. The second using the Binding type which doesn't.
Binding type is not "explicitly" broken, since it still exists. However, its "power" is lost when the target property is assigned - it seems not to monitor this fact and so does not warn.
-----------
Regarding BindingSilentBreak-updated:
The section of the Binding documentation contains the following example:
// produces warning: "Unable to assign [undefined] to double value"
value: if (mouse.pressed) mouse.mouseX
... which of course is an incomplete statement in itself and does not contain an explicit "else" clause and would produce this warning like any good compiler/interpreter. This isn't the warning I was discussing.
I have done some further investigation and cooked up some changes in my example. The Binding element will continue to apply its changes to the target property if its source property is updated.
The text "overwrite me!!" will be restored when the animation enabling checkbox is unchecked - but only if the button that breaks the original binding has not been pressed.
If the 2nd button is pressed now, you see the binding break warning message correctly. However, enabling the animation (which enables the Binding object) is started and stopped, the value "New Assigned Value" is NOT restored to the property. Is this a bug? Should the Binding object restore the property binding AND the value if no binding previously existed? What if the original binding were removed while the Binding object was active? What would it restore in that case when the when goes to false? It seems that if you break the original binding while the Binding object is active, it isn't actually broken and is restored as if it were never broken when the when property goes false.
Attachments
Issue Links
- relates to
-
QTBUG-87478 No binding overwrite, but binding overwritten
- Closed
-
QTBUG-33444 Binding does not restore original property value if it was assigned as a constant
- Closed
- resulted in
-
AUTOSUITE-1367 neptune output Binding warnings
- Closed
-
QTBUG-80523 QtVirtualKeyboad outputs QML Binding warnings
- Closed
-
QTBUG-81787 QtQml import has to come after QtQuick in order to avoid Binding's restoreMode warning
- Closed
-
QTBUG-84790 Source incompatible change in Qt 5.14's QML Binding (required argument restoreMode)
- Closed
For Gerrit Dashboard: QTBUG-78566 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
276014,2 | Re-add the warnings about deprecated default binding restore mode | 5.14 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
276459,5 | Doc: Add a \note about the (broken) Binding value restoration policy | 5.13.2 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
276798,3 | Postpone the Binding restore mode behavior change to Qt 6.0 | 5.14 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
276803,5 | QQmlBinding: Change the restoreMode default | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
276846,2 | Output a message when changing the target of a Binding from elsewhere | 5.14 | qt/qtdeclarative | Status: MERGED | +2 | 0 |