View Full Version : QListView icon list like explorer + resize dynamic

20th July 2018, 10:55
I try to achieve something very easy but looks like very complicated to have a working solution in Qt.
I have a QListWidget and I simply try to have the icons like windows explorer, meaning a space between each of them on top, bottom, left and right.
Additionally I try to have the size dynamically change to always use the whole space of the widget, simple linear interpolation from min size to max size then it adds a new icon to the row.
Is it possible to have some help ?
Thank you

23rd July 2018, 20:52
Don't understand completely what you need but are you looking for QListView::IconMode view mode? http://doc.qt.io/qt-5/qlistview.html#ViewMode-enum

7th August 2018, 00:26
I'm trying to have something like windows explorer: https://mspoweruser.com/wp-content/uploads/2016/03/Windows-File-Explorer.jpg
Icon mode of QListWidget works but the space between the items don't have the same behavior as windows explorer.
All the icon are next to each other without any empty space around them.
When you resize it, it should resize the item to take the most of space possible keeping the empty space around the items.

7th August 2018, 19:15
Maybe the Flow Layout (https://doc.qt.io/qt-5/qtwidgets-layouts-flowlayout-example.html) will do what you want. If all the items are the same size, I believe it will space them evenly.