@BikashRDas If you need to have a read/write access you could do it like this:
import QtQuick 2.5
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.2
Item {
id: _root
property string textData
onTextDataChanged: {
if(ldr.status === Loader.Ready)
ldr.item.text = textData
}
ColumnLayout {
id: cl
Switch {
id: switchButton
checked: true
onCheckedChanged: {
console.log(ldr.item.placeholderText)
}
}
Text {
id: label
text: "Text field"
}
Loader {
id: ldr
property string textData
onTextDataChanged: _root.textData = textData
sourceComponent: switchButton.checked === true ? c1 : c2
onLoaded: {
// read current value
textData = item.text
// update value on text changes
textData = Qt.bindings(Qt.binding(function () { return item.text; })
}
}
}
...
}
I think there is no risk about "binding loop", but I don't guarantee anything... Try it out.