Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QListView icon mode not relayout when resize

Tags:

qt

qlistview

I have a QListView with IconMode view, LeftToRight flow, and wrapping is true.
But I have a problem when I resize the widget that the item is not relayout.
Is there any way to make it relayout? Many thanks for any help.

Start listview :
List view at start


List view after resize :
after resize

like image 271
Apin Avatar asked Jan 20 '16 09:01

Apin


1 Answers

You need to set the resize mode setResizeMode(QListView::Adjust)

The default is "Fixed" not "Adjust"

Look here: https://doc.qt.io/qt-5/qlistview.html#resizeMode-prop

And: https://doc.qt.io/qt-5/qlistview.html#ResizeMode-enum

And:https://doc.qt.io/qt-4.8/qlistview.html#isWrapping-prop

like image 175
gj13 Avatar answered Sep 16 '22 12:09

gj13