Suggestions for populating ListView in a Slide based menu UI
-
Hello!
I am currently working on a program that uses a "slide" like based UI to step through the menu system. Each level of the menu is represented by a new slide that appears to the user (on top of the previous slide) with its own listView of the current menu level. Some of the menu system are dynamic (browsing music/albums/songs from db) so I can't just use fixed listView models. For example the menu would have: albums songs genres, clicking albums would show a slide with all the available albums in the db and the next slide would show the songs in the selected album.
At this point I have created a generic slide system using QML that allows me to add as many slides as I please and I created a system to step through the levels of slides, first in JavaScript, and now in C++. The main idea is that I pass the "slide holder" object that contains the slides to the C++ end and change the states of the slides according to the users index in the menu system. Up to this stage I have had no issues..
Right now I am trying to figure out the best way to populate the ListViews in the slide system. In my testing I have been able to populate ListViews from C++ at run time using the "setContextProperty" and add items to the models on a button click. Using this method though means that I have to have a model set before hand for each of the slides ListViews and then based off where the user is in the menu system add the appropriate items to the model of the current slide. This has been causing me grief since I have to figure out what slide I am on and then call the function to clear then load the proper content into the proper model.
Ideally I would like to change the slide state, as I am doing, and create a model that I set the ListView model property of the slide to. In practice I have not been able to set the model property without crashing the program...
My question basically comes down to should I follow the direction of having a model object set using "setContextProperty" for each slide at run time that I populate with the corresponding items when the user steps through each menu or is there another way I should be looking at?
Thanks for your help!