QListWidget: More icons on one row

可紊 提交于 2019-12-23 03:04:30

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!