diff options
author | Erik Verbruggen <erik.verbruggen@qt.io> | 2016-11-03 14:31:19 +0100 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2016-11-09 09:15:58 +0000 |
commit | ece0682712ec23b2a7fed68893db71a2cc0370a7 (patch) | |
tree | 892991f9c62b075c58a3af11f63246c7fdc93fa6 | |
parent | 2afee1c3f13a8dde2ad6d12e62c291e44fff262b (diff) |
Quick: Hint that a reparent action will most probably work fine
When assigning an item a new parent item, a check is done if it is
already part of the children tree below that parent. This is an unlikely
case, so hint the compiler that it can optimize the loop that way.
Change-Id: Ic9f1810aa4b83d84be88f0049e61d21c4add7767
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | src/quick/items/qquickitem.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 9e86247162..1e60ef8c02 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -2603,7 +2603,7 @@ void QQuickItem::setParentItem(QQuickItem *parentItem) if (parentItem) { QQuickItem *itemAncestor = parentItem; while (itemAncestor != 0) { - if (itemAncestor == this) { + if (Q_UNLIKELY(itemAncestor == this)) { qWarning() << "QQuickItem::setParentItem: Parent" << parentItem << "is already part of the subtree of" << this; return; } |