Application Architecture (StackView)
I have been happily coding along making a navigation system for my application using a ListView. As I choose items from the list and need to load different data I am changing the model of the list programatically. So I really only ever have one ListView and the model just keeps changing. Now I am embarking on the task of keeping track of a stack of model id's so that I can move back and forth in the navigation system.
I see that StackView is a nice implementation of such a scenario. I cant decide if I should create several different ListViews and add them to a StackView for navigation or if I should just keep track of models within my one ListView. The only reason I can think of to stick with the one ListView is to conserve memory. Do you think that makes sense? Hard to say how many different ListViews I will ultimately need if I decide to go that way. Maybe 15 or 20 at the most.
so what i did understand is that you need multiple models, right? Well i would recomment you to create one custom model in Cpp and pass it to QML.
You can use the StackView and re-use the same ListView over and over again if you want. When pushing a item onto the stack you can pass in arguments.
See http://qt-project.org/doc/qt-5.1/qtquickcontrols/qml-qtquick-controls1-stackview.html section Pushing Items
One argument could be the a reference to the model to be loaded. values in the properties argument the are applied on construction of the list view.
Back is then automatically handled using pop() (selection preservation). The overhead in memory is to have all stacked list views in memory. If a list view is popped it will be destroyed.
Also having these 20 different list view as separate files or components inside your project.
If you need a C++ model, depends where your data comes from.