View Full Version : QListView with icons on top of the text, not at the left

30th January 2006, 15:44
I'm using QT4 and I would like to have a widget similar to QListView but displaying the icons over the text in each item. It would be something like this:


The screenshot belongs to the configuration dialog of Konqueror. I haven't found any way to put the icons on top, I only get this:


Any idea on how to do that?

30th January 2006, 16:08
You need to

QListView::setFlow (QListView::TopToBottom);

This should work. Though i am not sure, as i only checked the docs, and have not used before.

30th January 2006, 16:14
have a look at the
Config Dialog Example

This is exactly what you are looking for.


30th January 2006, 17:15
Thanks, I already tried setting the view mode to IconMode and this is what I get:


Probably tweaking the alignment would be ok but I would prefer it to look like this (it's just a mockup):


And then I would adjust the size so that it's not that wide, making it look just like Konqueror and other KDE apps.

30th January 2006, 17:33
Thanks, I already tried setting the view mode to IconMode and this is what I get: .......

This will get you closer: - :cool:

QListView::setFlow (QListView::TopToBottom);

30th January 2006, 18:45
Great! With setWrapping() it looks much better. I think I'll leave it this way. If I find some way to make the background look like it's selected I'll change it, otherwise I'll leave it like it's now. Thanks!

18th February 2009, 14:23
I have question closely related to this topic.

Is there way to remove file names from QlistView in iconmode? I have my own listview class derived from QListView. It display thumbnails of certain images. Images will be very clearly self explaining, so those file names will just make UI more unclear.

19th February 2009, 05:19
Well, if you dont want text at all, you can override data() function of the model, and return empty string (QString()) for Qt::DisplayRole.

If you want changes only in icon mode, best would be to make your own delegate and do nothing in drawDisplay.