Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Selection model for a Flow layout?
QtWS25 Last Chance

Selection model for a Flow layout?

Scheduled Pinned Locked Moved Unsolved General and Desktop
flowlayout seleselection modellist view
5 Posts 2 Posters 756 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BwvB
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You are mixing item views and layouts which are separated concepts.

      If you want selection capabilities, you might want to use a QListView in icon mode rather than the flow layout.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      B 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        You are mixing item views and layouts which are separated concepts.

        If you want selection capabilities, you might want to use a QListView in icon mode rather than the flow layout.

        B Offline
        B Offline
        BwvB
        wrote on last edited by
        #3

        @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

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          B 1 Reply Last reply
          1
          • SGaistS SGaist

            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.

            B Offline
            B Offline
            BwvB
            wrote on last edited by
            #5

            @SGaist Hi, thanks for responding. This is a very good suggestion! I'm going to dive in it.

            Regards,
            Bw

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved