Selection model for a Flow layout?
-
Hi,
I have a viewer that displays many images (thumbnails, really) in a linear fashion, using a layout very similar to the one presented in the Flow layout example, one of the standard examples that comes with Qt: <QTDIR>/examples/widgets/layouts/flowlayout.
I now want to add the possibility of making a selection of the images shown.
Reading through the Qt documentation, I apparently need to add a QSelectionModel to this view, but I am stuck, really, how to do that with the given View. Can somebody help me out?Demonstrating it using the flow layout examples (but with any more words..) would be ideal.
Thanks in advance.
Bertwim -
@SGaist HI, thanks for responding.
I have tried QListView. It comes close to what I need. But I failed to tailor it such that it behaved as I needed.
For one, with QListView, I did not succeed in loading the images (icons) in a multi-threaded fashion. Secondly, I had a couple of other needs for each individual thumbnail (namely, images+optional lines with exif data) that I found rather hard to squeeze in a QListView context. I just could not get it right. Then I found the Flow layout example, which made a straightforward implementation possible. A bit to my surprise, it turned out that with all the thumbnails shown on a single canvas, I could still click on individual thumbnails and do an action on it. Which made me hope and think that doing something on a collection of items should not be too difficult. But so far, no solution...Regards
Bw -
If you want threaded loading you are going to have to build your own model for that.
Depending on what you need to do, the graphics view framework could be another option. You can easily have selectable item and IIRC, it also provides an equivalent of layouts.