Good way to make a thumbnail grid?
-
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)!
-
"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.
-
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?
-
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...
-
Or just extend QLabel. Or use QPushButton instead of QLabel, it supports both caption text and icon.