mirror of https://gitee.com/openkylin/peony.git
修复由78165e78b3e84fe3075bc05a2e31a4b940cb68fe引入的死循环代码
This commit is contained in:
parent
af93ea0994
commit
f49b1b5637
|
@ -230,18 +230,23 @@ DesktopIconView::DesktopIconView(QWidget *parent) : QListView(parent)
|
|||
for (auto item : needRelayoutItems) {
|
||||
QRect itemRect = QRect(posX, posY, gridWidth, gridHeight);
|
||||
while (notEmptyRegion.intersects(itemRect)) {
|
||||
// 到下一个位置
|
||||
if (posY + 2*gridHeight > this->viewport()->height()) {
|
||||
posY = marginTop;
|
||||
posX += gridWidth;
|
||||
} else {
|
||||
posY += gridHeight;
|
||||
}
|
||||
if (this->viewport()->geometry().contains(itemRect)) {
|
||||
// 进行下一次判断
|
||||
itemRect.moveTo(posX, posY);
|
||||
} else {
|
||||
// 跳出while循环,并且设置坐标为(0,0)
|
||||
itemRect.moveTo(0, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (this->viewport()->geometry().contains(itemRect)) {
|
||||
itemRect.moveTo(posX, posY);
|
||||
} else {
|
||||
itemRect.moveTo(0, 0);
|
||||
}
|
||||
|
||||
notEmptyRegion += itemRect;
|
||||
m_item_rect_hash.insert(item, itemRect);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue