I'm writing a QML GUI that talks to a monitoring server. In one case, there's 3 grouped remote systems, one is is a master, the other two are slaves. I have the full statuses of each one, but need to show more details for the master system.
So for example I'm receiving an update message containing:
{
systems: {
1: {
type: Debian,
name: system1,
status: OK,
detailedStatus1: 123,
detailedStatus2: xyz
},
2: {
type: Ubuntu,
name: system2,
status: OK,
detailedStatus1: 456,
detailedStatus2: abc
},
3: {
type: Windows,
name: system3,
status: OK,
detailedStatus1: 789,
detailedStatus2: def
}
},
currentMaster: (1 or 2 or 3)
}
...and I want to show type, name, and status for all 3 systems, but only show detailedStatus1 and detailedStatus2 for the currentMaster system.
What should my QML model be like? Should I have a "masterModel ListModel" that my detailedStatus widgets bind to, and an "allsystems ListModel" for type/name/status, and update masterModel everytime currentMaster changes? Or is there a way to do this from a single "allsystems ListModel" , using currentMaster to know what to bind to? Should I be doing something else altogether?