PDA

View Full Version : QListView with image and text!



Faster
27th June 2009, 21:48
I would like to create a custom widget in a QListView with an icon and a text like in the picture. Anybody could help me?? Thanks!

wysota
27th June 2009, 22:03
So? What's the problem? What did you already try?

Faster
27th June 2009, 22:15
I would to create something like the widget in the picture but I'm new with Qt4 and I don't know how I can do it! Any help?

wysota
27th June 2009, 22:32
It would be better if you posted in the newbie section if you consider yourself one...

Take a look at QStandardItemModel, QStandardItem::setText and QStandardItem::setIcon.

Faster
27th June 2009, 22:48
ok thanks!

Faster
27th June 2009, 23:37
I would to create something like the listWidget in the picture but I'm new with Qt4 and I don't know how I can do it! Any help?

wysota
28th June 2009, 00:32
Please don't start multiple threads on the same subject. Threads merged.

Faster
28th June 2009, 10:28
How I could use QStandardItemModel to create this listView? Anybody could post an example please?

wysota
28th June 2009, 10:40
Did you follow the links I gave you?

Faster
28th June 2009, 11:56
Yes! But I would to create a thing more complex using QItemDelegate like this http://www.qtcentre.org/forum/f-qt-programming-2/t-drawing-a-widget-in-qitemdelegates-paint-method-8660.html. I would display a custom resized image (jpg, png, bmp) and html text instead of plain text in a listView but I don't know how to use QItemDelegate. (sorry for my poor English). :(

wysota
28th June 2009, 14:53
Learn the basics first. If you don't know how to use models then you won't be able to implement a delegate. The image you posted uses a standard delegate and the two roles I mentioned.