Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Suggestions for populating ListView in a Slide based menu UI
LiquidWater last edited by
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.
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!