summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicslayout_p.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/graphicsview/qgraphicslayout_p.cpp')
-rw-r--r--src/gui/graphicsview/qgraphicslayout_p.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/graphicsview/qgraphicslayout_p.cpp b/src/gui/graphicsview/qgraphicslayout_p.cpp
index 2b77912..6411ca0 100644
--- a/src/gui/graphicsview/qgraphicslayout_p.cpp
+++ b/src/gui/graphicsview/qgraphicslayout_p.cpp
@@ -120,8 +120,8 @@ static bool removeLayoutItemFromLayout(QGraphicsLayout *lay, QGraphicsLayoutItem
if (!lay)
return false;
- QGraphicsLayoutItem *child;
- for (int i = 0; (child = lay->itemAt(i)); ++i) {
+ for (int i = lay->count() - 1; i >= 0; --i) {
+ QGraphicsLayoutItem *child = lay->itemAt(i);
if (child && child->isLayout()) {
if (removeLayoutItemFromLayout(static_cast<QGraphicsLayout*>(child), layoutItem))
return true;