PDA

View Full Version : set QListWidget/QTreeWidget icon size



rbp
13th October 2009, 05:06
hello,

is there a way to increase the icon size of items in a QListWidget/QTreeWidget? I tried increasing the font point size, but that only affected the text.

My QIcon images are quite large (eg 300x300), so they can afford to be larger than the default.

Richard

aamer4yu
13th October 2009, 06:31
You can call QAbstractItemView::setIconSize .
QListWidget/ QTreeWidget are inherited from QAbstractItemView

rbp
13th October 2009, 07:27
thanks!

I found increasing the icon size like this causes the item icons to touch. So is there a way to add padding?

aamer4yu
13th October 2009, 12:01
And what do you mean by

I found increasing the icon size like this causes the item icons to touch
??

May be you try setting the margin with style sheet... else other alternatives include using a custom delegate.

rbp
14th October 2009, 03:05
With the default icon size there is space between the icons in adjacent items, but when I increase the icon size this space is not maintained so that the icons appear joined. Hope that makes sense.

I'll have a look into style sheets.