Hello,
I’m trying to set up a basic connection between two AppSwitch elements. The connection is very simple, I have two switches, the main switch and a sub switch, as seen below.
App {
id: app
property bool main_switch: false
property bool sub_switch: false
AppSwitch {
checked: app.main_switch
onToggled: {
app.main_switch = !app.main_switch;
app.sub_switch = !app.sub_switch
}
}
AppSwitch {
checked: app.sub_switch
onToggled: {
app.sub_switch = !app.sub_switch
}
}
}
When I first load the app, if I click the main switch, the sub switch also changes as expected, regardless of what the initial states are of either switch. However, once I flip the sub switch manually, the ‘connection’ is lost in that when I subsequently switch the main switch, the sub swtich no longer flips even though the value of app.sub_switch does in fact change as it should.
It seems I’m not understanding the ‘checked’ value. It seems to me that regardless of what changes app.sub_switch to true or false, the switch itself should change, is that not true? Could someone help me understand why I’m not getting the expected action?
Thank you.