问题
For my bachelor thesis I'm programming an Role Playing Game maker. I'm making use of tilesets (left picture below). I load such an image in my project and split it in small square blocks (tiles). Now, I load these in a QListWidget, but I would like the QListWidget to show as many tiles in a row as there are in the image (for example: the image below contains 8 tiles/row, but in my program, the QListWidget only shows 6 tiles per row).
I have tried to work with layouts, but these don't seem to work. Any idea on how to let the QListWidget display a custom amount of items per row? I like to work with the QListWidget because it provides a good way of selecting the tiles and propagating to the parent widgets which tile should be drawn in another widget.
Thanks in advance.
回答1:
You may have an easier time using a QTreeWidget or QTableWidget.
回答2:
well... I am not 100 % happy with the current answer from user336063
the QListWidget has a "viewMode" property,
if you set that to IconMode your list will look like:
by default it looks like:
来源:https://stackoverflow.com/questions/10019431/qlistwidget-more-icons-on-one-row