How can I choose which Item to display?
-
I have two
Item
's one displays information with aGridView
and the other displays the same information with aListView
. I want to keep them part of the sameComponent
but I would like to be able to choose between one or the other depending on the circumstances. If, in the even the user is trying to display the data in what I am calling a "details page" then I want theComponent
to select theListView
item but otherwise it should be displayed in aGridView
. What's the common way of doing this? Is it done withstates
andvisibility
or perhaps it's done withfocus
scopes? -
There's also https://doc.qt.io/qt-5.12/qml-qt-labs-qmlmodels-delegatechooser.html - it is still in labs but we're already using this for dynamic delegates e.g.: texedit control vs label - based on modelIndex role being edit or display etc.