qt - 调整大小时 QListView 图标模式不重新布局

标签 qt qlistview

我有一个带有 IconMode View 、LeftToRight 流的 QListView,并且包装是正确的。
但是当我调整小部件的大小时,我遇到了一个问题,即该项目不是重新布局。
有没有办法让它重新布局?非常感谢您的帮助。

开始 ListView :
List view at start

调整大小后的 ListView :
after resize

最佳答案

您需要设置调整大小模式setResizeMode(QListView::Adjust)
默认为“固定”而不是“调整”

看这里:https://doc.qt.io/qt-5/qlistview.html#resizeMode-prop

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

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

关于qt - 调整大小时 QListView 图标模式不重新布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34896534/

相关文章:

c++ - QStandarditem 拒绝构造函数中的 QString

c++ - 选中多个项目时如何清除QListView的选择?

c++ - 删除 QListView 中的选定项目列表

c++ - Qt:如何在委托(delegate)绘制事件中渲染时增加 QTablewidget?

c++ - 如何获取QListView中选中行的索引或字符串?

macos - 如何使用 qmake 和 macdeployqt 缩小应用程序

c++ - QTableView 行样式

python - 将 C++ 行转换为 Python 3

php - 将 XSLT 1.0 转换为 XSLT 2.0

c++ - QListView 中的 QT 超链接