QListView icon mode not relayout when resize
Asked Answered
A

1

7

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

Abundance answered 20/1, 2016 at 9:45 Comment(0)
O
5

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

Overscrupulous answered 20/1, 2016 at 10:8 Comment(1)
thanks for your help, I have another problem. I have 1000 data in my model, when it resize -> it really heavy. Is there anything to do to optimize it?Abundance

© 2022 - 2024 — McMap. All rights reserved.