Unsolved How to programmatically select multiple rows in QListView?
-
I have written a program where the user can select multiple rows from a QListView. Sometimes the program need to load a set of selection at startup, so the program needs to be able to select multiple rows from code. How can this be done?
-
Use the correct QListView method to get the container of items in the list, iterate through it, and set the "checked/selected" attribute for each item that matches your selection cirteria.
-
Sorry, can you show me how it is written in code?
-
You should take a look at QItemSelectionModel::select()
-
@Christian-Ehrlicher
Ok thanks! I got it to work.