-
Notifications
You must be signed in to change notification settings - Fork 87
Open
Description
Thanks for your work.
But in reality the "transient binding" described here https://github.com/Furkanzmc/QML-Coding-Guide#transient-bindings
looks like broke existing binding.
In code bellow expect that after destroying temp the previous binding cfg_flag1 -> flag1 will work,
but actually it doesn't work right after "transient binding" creation it stops work.
I tried with Qt 5.15.1
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("buggon1 cliecked");
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();
}
}
Component {
id: cmpBinding
Binding {
}
}
}
Metadata
Metadata
Assignees
Labels
No labels