Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED] What widget is better to show images in a list?
So what i want is this
What is the better widget on creating something like this? I am very familiar with listwidget and my friend has reached this point:
but i dont like every image to have a text under it.. so if i remove the text something ugly happens:
there is a gray line under the images..
So what must i use? qlistwidget, qlistview or what?
And if it is qlistview, could you quide me just a little?
henryxuv last edited by
Can't see the pics.
henryxuv last edited by
Ah,I think you can try the QStackedLayout to implement this effect.
giesbert last edited by
You can use a list view and a model.
Just return the pixmap as Qt::DisplayRole, that should not put any text below it, right?
[quote author="Gerolf" date="1346400224"]You can use a list view and a model.
Just return the pixmap as Qt::DisplayRole, that should not put any text below it, right?[/quote]
i am a complete newbie to listview so i tried it..
what i managed is this:
@ QStandardItem* Item1 = new QStandardItem(QIcon(":/image1.png"), "Text1");
QStandardItem* Item2 = new QStandardItem(QIcon(":/image2.png"), "Text2");
QStandardItem* Item3 = new QStandardItem(QIcon(":/image3.png"), "Text3");
QStandardItemModel* ListModel = new QStandardItemModel();
1st i can't remove the "Text".. What should i do for this..
and 2nd i don't want the items to be showen every row.. but as the screenshots at the 1st post.. it seems i can see only appendrow/column not something like additem..
[quote author="henryxuv" date="1346400067"]Ah,I think you can try the QStackedLayout to implement this effect.[/quote]
No this isn't what i want.. Listview is what i want.. can anyone answer what i asked above?
DerManu last edited by
Have you tried subclassing QAbstractItemModel or QAbstractListModel instead of using QStandardItemModel? Further: To have items fill from left to right and wrap, use setFlow and setWrapping, but that seems to be in place already considering your posted screenshots.
Well we ended up using listwidget! About the grey thing that appears, we found a "solution" , with this:
which height is smaller making the grey thing not appear!
I took a screenshot to show it, in which i zoomed in one item ;)
Even the qt exampe Puzzle had and yet has this problem: