Comments (4)
经测试,是 QListView.setResizeMode(QtWidgets.QListView.Adjust) 的锅,每次窗口大小修改,需要重新计算布局(每行多少个)
from dayu_widgets.
https://code.qt.io/cgit/qt/qtbase.git/plain/src/widgets/itemviews/qlistview.cpp
源码里面已经做了延迟(0.1秒) layout 处理了,所以我们在放大窗口的时候,可以明显看到一个白色背景(我们ListView是个深色背景,没有立马跟着变大),所以,要么我们加大延迟,则白边效果会更显著;要么我们就搞分页;
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);
}
}
from dayu_widgets.
之前我用原生listview的时候用的方法是直接在listveiw的resizeEvent中用listview的setSpacing和setGridSize效果倒是不会出现卡的现象,下面这个视频里面也是100多个的图标
视频
from dayu_widgets.
确实一个人精力有限,只能考虑一般情况。
非常欢迎你贡献代码,这里有 如何贡献代码 的步骤
from dayu_widgets.
Related Issues (20)
- High DPI Problem
- MSortFilterModel 开启 recursiveFilteringEnabled 过滤触发报错
- No module named 'dayu_path' HOT 3
- Maya 2018 & Maya 2020 looks different HOT 1
- 用 pyside2uic 编译的 MPushButton 会导致传参错误 HOT 1
- MLabel引起线程问题崩溃 HOT 4
- 当前版本在3dsmax运行的问题 HOT 4
- 在houdini中实例化MDivider错误 HOT 4
- 当使用中文输入法输入文字,MLineEdit 不发射 sig_delay_text_changed 信号 HOT 1
- MPage的页数信号错误 HOT 2
- Dependency Dashboard
- MMessage 显示位置错误 HOT 4
- 少了一个叫Qt的package, 或者需求的安装环境怎样的? HOT 1
- 有办法用到qt-designer上吗? HOT 1
- page.py模块的几个问题
- MBigView的图标最大最小值默认值提取到MTheme里面 HOT 1
- 支持Python3.10+
- 修复MToolButton设置大小后图标不随之变大的bug HOT 1
- 怎样在写 maya界面时用呢
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dayu_widgets.