Details
-
Bug
-
Resolution: Incomplete
-
Not Evaluated
-
5.15.1
Description
In code create static binding: "property bool flag1: cfg_flag1",
and also create dynamic binding via createObject.
I expect that either get warning "Overwriting binding on" or
after destroying dynamic binding the old one would work.
But old binding cleary not working after creating new binding
and destroying it. And with QT_LOGGING_RULES="qt.qml.binding.removal.info=true"
I didn't see any warning about overriding binding.
import QtQuick 2.0 import QtQuick.Controls 2.15 Rectangle { id: rect width: 100 height: 100 color: "red" property bool flag1: { console.log("set flag1 to", cfg_flag1); return cfg_flag1; } property bool cfg_flag1: true Text { anchors.centerIn: parent text: "flag1: " + flag1.toString() + ", cfg_flag1 " + cfg_flag1.toString() } Timer { id: timer interval: 1000 repeat: false onTriggered: { console.log("timer trigger"); cfg_flag1 = false; } } Button { anchors.top: parent.top text: "button 1" onClicked: { console.log("button 1 clicked"); let temp = cmpBinding.createObject(rect, { "target": rect, "property": "flag1", "value": true, "restoreMode": Binding.RestoreBinding, }); temp.Component.onDestruction.connect(function() { console.log("destroyed"); }); temp.destroy(); console.log("end of clicked"); timer.start(); } } Button { anchors.bottom: parent.bottom text: "button 2" onClicked: { console.log("button 2 clicked"); cfg_flag1 = true; cfg_flag1 = false; } } Component { id: cmpBinding Binding { } } }
Attachments
Issue Links
- relates to
-
QTBUG-78566 Binding QML Type does not warn on qt.qml.binding.removal
- Closed