-
UID:173557
-
- 注册时间2016-06-21
- 最后登录2024-12-29
- 在线时间508小时
-
- 发帖265
- 搜Ta的帖子
- 精华0
- 金钱5220
- 威望277
- 贡献值2
- 好评度267
-
访问TA的空间加好友用道具
|
效果图
核心代码- if(itemList[i]->sizeHint().height() == 0) continue;
- int nextX = x + itemList[i]->sizeHint().width() + spaceX;
- int nextY = y;
- if(x > effectiveRect.x()){
- nextX = x;
- nextY = y + itemList[i]->sizeHint().height() + spaceY;
- if(nextY - spaceY >= preY + lineHeight && lineHeight > 0 && lineWidth > 0){
- x = x + lineWidth + spaceX;
- y = preY;
- nextX = x;
- nextY = y + itemList[i]->sizeHint().height() + spaceY;
- lineWidth = 0;
- }
- lineWidth = qMax(lineWidth, itemList[i]->sizeHint().width());
- }
- if (nextX + itemList[i]->sizeHint().width() > effectiveRect.right() && lineHeight > 0) {
- x = effectiveRect.x();
- y = preY + lineHeight + spaceY;
- preY = y;
- nextX = x + itemList[i]->sizeHint().width() + spaceX;
- nextY = y;
- lineHeight = 0;
- lineWidth = 0;
- }
- if (!testOnly)
- {
- itemList[i]->setGeometry(QRect(QPoint(x, y), itemList[i]->sizeHint()));
- }
-
- lineHeight = qMax(lineHeight, itemList[i]->sizeHint().height());
- x = nextX;
- y = nextY;
- }
更多精彩内容: 欢迎访问雨田哥博客
|