-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MItemViewSet BigViewType的刷新问题 #42
Comments
经测试,是 QListView.setResizeMode(QtWidgets.QListView.Adjust) 的锅,每次窗口大小修改,需要重新计算布局(每行多少个) |
https://code.qt.io/cgit/qt/qtbase.git/plain/src/widgets/itemviews/qlistview.cpp void QListView::resizeEvent(QResizeEvent *e)
{
Q_D(QListView);
if (d->delayedPendingLayout)
return;
QSize delta = e->size() - e->oldSize();
if (delta.isNull())
return;
bool listWrap = (d->viewMode == ListMode) && d->wrapItemText;
bool flowDimensionChanged = (d->flow == LeftToRight && delta.width() != 0)
|| (d->flow == TopToBottom && delta.height() != 0);
// We post a delayed relayout in the following cases :
// - we're wrapping
// - the state is NoState, we're adjusting and the size has changed in the flowing direction
if (listWrap
|| (state() == NoState && d->resizeMode == Adjust && flowDimensionChanged)) {
d->doDelayedItemsLayout(100); // wait 1/10 sec before starting the layout
} else {
QAbstractItemView::resizeEvent(e);
}
} |
之前我用原生listview的时候用的方法是直接在listveiw的resizeEvent中用listview的setSpacing和setGridSize效果倒是不会出现卡的现象,下面这个视频里面也是100多个的图标 |
确实一个人精力有限,只能考虑一般情况。 |
使用MItemViewSet BigViewType时,当数量多时(100以上),改变窗口大小会有明显的卡顿问题,是因为改变大小都会多次重新设置model里的data吗?
操作录屏
The text was updated successfully, but these errors were encountered: