diff options
author | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2011-06-10 13:35:50 +0200 |
---|---|---|
committer | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2011-06-10 13:35:50 +0200 |
commit | 199635ad73b223cd993869ce088faef8d1ecad0c (patch) | |
tree | 4c42b0679c952367c452640d8cc0c660bad757d4 | |
parent | 71c9da36a71e5cac6312db97169fc641e5d274ea (diff) |
Added QSGNode::removeAllChildNodes().
-rw-r--r-- | src/declarative/items/qsgcanvas.cpp | 12 | ||||
-rw-r--r-- | src/declarative/scenegraph/coreapi/qsgnode.cpp | 16 | ||||
-rw-r--r-- | src/declarative/scenegraph/coreapi/qsgnode.h | 1 |
3 files changed, 20 insertions, 9 deletions
diff --git a/src/declarative/items/qsgcanvas.cpp b/src/declarative/items/qsgcanvas.cpp index 614c826563..f38e0b5ebc 100644 --- a/src/declarative/items/qsgcanvas.cpp +++ b/src/declarative/items/qsgcanvas.cpp @@ -1615,10 +1615,8 @@ void QSGCanvasPrivate::updateDirtyNode(QSGItem *item) } } - if (dirty & QSGItemPrivate::ChildrenUpdateMask) { - while (itemPriv->childContainerNode()->childCount()) - itemPriv->childContainerNode()->removeChildNode(itemPriv->childContainerNode()->childAtIndex(0)); - } + if (dirty & QSGItemPrivate::ChildrenUpdateMask) + itemPriv->childContainerNode()->removeAllChildNodes(); if (effectRefEffectivelyChanged) { QSGNode *parent = itemPriv->clipNode; @@ -1651,10 +1649,8 @@ void QSGCanvasPrivate::updateDirtyNode(QSGItem *item) if (dirty & QSGItemPrivate::ChildrenUpdateMask) { QSGNode *groupNode = itemPriv->groupNode; - if (groupNode) { - for (int count = groupNode->childCount(); count; --count) - groupNode->removeChildNode(groupNode->childAtIndex(0)); - } + if (groupNode) + groupNode->removeAllChildNodes(); QList<QSGItem *> orderedChildren = itemPriv->paintOrderChildItems(); int ii = 0; diff --git a/src/declarative/scenegraph/coreapi/qsgnode.cpp b/src/declarative/scenegraph/coreapi/qsgnode.cpp index b0a5f04035..347aad61bc 100644 --- a/src/declarative/scenegraph/coreapi/qsgnode.cpp +++ b/src/declarative/scenegraph/coreapi/qsgnode.cpp @@ -305,7 +305,7 @@ void QSGNode::insertChildNodeAfter(QSGNode *node, QSGNode *after) /*! - Removes \a node fromt his node's list of children. + Removes \a node from this node's list of children. */ void QSGNode::removeChildNode(QSGNode *node) @@ -321,6 +321,20 @@ void QSGNode::removeChildNode(QSGNode *node) /*! + Removes all child nodes from this node's list of children. + */ + +void QSGNode::removeAllChildNodes() +{ + while (!m_children.isEmpty()) { + QSGNode *node = m_children.takeLast(); + node->markDirty(DirtyNodeRemoved); + node->m_parent = 0; + } +} + + +/*! Sets the flag \a f on this node if \a enabled is true; otherwise clears the flag. diff --git a/src/declarative/scenegraph/coreapi/qsgnode.h b/src/declarative/scenegraph/coreapi/qsgnode.h index fa45e0f74c..b2444d593c 100644 --- a/src/declarative/scenegraph/coreapi/qsgnode.h +++ b/src/declarative/scenegraph/coreapi/qsgnode.h @@ -118,6 +118,7 @@ public: QSGNode *parent() const { return m_parent; } void removeChildNode(QSGNode *node); + void removeAllChildNodes(); void prependChildNode(QSGNode *node); void appendChildNode(QSGNode *node); void insertChildNodeBefore(QSGNode *node, QSGNode *before); |