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. Good way to make a thumbnail grid?

Good way to make a thumbnail grid?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 4.3k Views 1 Watching
  • 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.
  • A Offline
    A Offline
    Adelost
    wrote on last edited by
    #1

    How would one go about to create a good thumbnail grid?
    I would like to use it to display a preview of a lot of 3D models, similar to this image (from the game Overgrowth).

    !http://i.imgur.com/DtWbkTG.png(Thumbnail grid in Qt)!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MuldeR
      wrote on last edited by
      #2

      "QGridLayout":http://qt-project.org/doc/qt-4.8/qgridlayout.html + "QLabel":http://qt-project.org/doc/qt-4.8/qlabel.html + "QScrollArea":http://qt-project.org/doc/qt-4.8/qscrollarea.html

      Use QLabel::setPixmap() to show your images inside a QLabel widget.

      My OpenSource software at: http://muldersoft.com/

      Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

      Go visit the coop: http://youtu.be/Jay...

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Adelost
        wrote on last edited by
        #3

        How would I then do if I would like to click on individual labels? Would you suggest subclassing QLabel and implemented a mousePressEvent?

        Also, I noticed you can "setViewMode" to QListView::IconMode on a QListView. The grid doesn't resize automatically, and Items doesn't snap to the grid by default, but would perhaps this be a better approach?

        1 Reply Last reply
        0
        • M Offline
          M Offline
          MuldeR
          wrote on last edited by
          #4

          You could install your own class as an event filter for your QLabel's:
          QLabel::installEventFilter()

          This should allow you to react on any events that don't have a signal in QLabel, e.g. mouse clicks...

          My OpenSource software at: http://muldersoft.com/

          Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

          Go visit the coop: http://youtu.be/Jay...

          1 Reply Last reply
          0
          • U Offline
            U Offline
            utcenter
            wrote on last edited by
            #5

            Or just extend QLabel. Or use QPushButton instead of QLabel, it supports both caption text and icon.

            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