PDA

View Full Version : QListWidget vertical align in iconmode



pvdk
6th April 2011, 15:02
Hi,

I guess this has been asked before but I've searched all over the place and cannot find a suitable solution.
Basically what I want to do: a configdialog like the Qt example but with a horizontal QListWidget.

Now this isn't a problem of course but the icons are not aligned properly. I want them to be vertically centered on the row. I tried to work with a QStyledItemDelegate and found a good example here: Align checkboxes in a view (http://developer.qt.nokia.com/faq/answer/how_can_i_align_the_checkboxes_in_a_view)

But I don't know how to modify this to work with my QListWidgetItems. The QStyleOptionViewItem is 48x48, my QListWidget::iconSize() and not the whole selectable area size :confused:

Here's a pastebin with a small compilable example of what it looks like right now:
Pastebin example (http://pastebin.com/zdAtMim8)

Any help greatly appreciated!

Regards,
pvdk.