QListWidget: More icons on one row

Go To StackoverFlow.com

1

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.

enter image description here enter image description here

2012-04-04 21:20
by Jan Discart
You may have an easier time using a QTreeWidget or QTableWidget - NoName 2012-04-04 21:46
I have been blindly staring on how I could get it working with the QListWidget that I forgot to look at other types... Thank you for pointing that out! The QTableWidget seems to be perfect for the job - Jan Discart 2012-04-04 21:56
I made it into an answer to be accepted :- - NoName 2012-04-04 21:57


0

You may have an easier time using a QTreeWidget or QTableWidget.

2012-04-04 21:57
by NoName


0

well... I am not 100 % happy with the current answer from user336063

the QListWidget has a "viewMode" property,

enter image description here

if you set that to IconMode your list will look like:

enter image description here

by default it looks like:

enter image description here

2018-11-21 17:29
by ΦXocę 웃 Пepeúpa ツ
Ads