Reputation: 1191
In my QML application there are many components like map, video, console and so on. I want to allow the user to change current layout of components (position and visibility). The problem is that I want each layout to be separate .qml file which reuse already existing components. For example on layout switch map should not be destroyed and instantiated again. Here is an example of what I would like to avoid - each layout creates components only for themselves so layout cannot be changed. I had some experiments with reparenting components on state change but it produces a lot of code and nothing works.
Upvotes: 1
Views: 142
Reputation: 37697
Looks like you need to use states! Each state can arrange same items in different layout. They can even re-parent items.
Now question is: can you move state description to separate file. IMO it should work. I didn't try it.
Anyway items will not be recreated so you will achieve main goal.
Upvotes: 3