[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
This commit is contained in:
Kai Uwe Broulik 2017-09-28 23:05:36 +02:00
parent 9e7d02cde2
commit bb6b170516

View File

@ -528,9 +528,10 @@ QSGNode *FrameSvgItem::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaint
FrameNode* frameNode = static_cast<FrameNode*>(oldNode); FrameNode* frameNode = static_cast<FrameNode*>(oldNode);
QSize frameSize(width(), height()); QSize frameSize(width(), height());
QRect geometry = frameNode->contentsRect(frameSize); QRect geometry = frameNode->contentsRect(frameSize);
for(int i = 0; i<oldNode->childCount(); ++i) { QSGNode *node = oldNode->firstChild();
FrameItemNode* it = static_cast<FrameItemNode*>(oldNode->childAtIndex(i)); while (node) {
it->reposition(geometry, frameSize); static_cast<FrameItemNode *>(node)->reposition(geometry, frameSize);
node = node->nextSibling();
} }
m_sizeChanged = false; m_sizeChanged = false;