From bb6b17051673f4eea17744bf5fdd766412b53519 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Thu, 28 Sep 2017 23:05:36 +0200 Subject: [PATCH] [FrameSvgItem] Iterate child nodes properly Documentation says "Children are stored internally as a linked list, so iterating over the children via the index is suboptimal." Differential Revision: https://phabricator.kde.org/D8046 --- src/declarativeimports/core/framesvgitem.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/declarativeimports/core/framesvgitem.cpp b/src/declarativeimports/core/framesvgitem.cpp index af7e4beab..fcf8c5fe8 100644 --- a/src/declarativeimports/core/framesvgitem.cpp +++ b/src/declarativeimports/core/framesvgitem.cpp @@ -528,9 +528,10 @@ QSGNode *FrameSvgItem::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaint FrameNode* frameNode = static_cast(oldNode); QSize frameSize(width(), height()); QRect geometry = frameNode->contentsRect(frameSize); - for(int i = 0; ichildCount(); ++i) { - FrameItemNode* it = static_cast(oldNode->childAtIndex(i)); - it->reposition(geometry, frameSize); + QSGNode *node = oldNode->firstChild(); + while (node) { + static_cast(node)->reposition(geometry, frameSize); + node = node->nextSibling(); } m_sizeChanged = false;