diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-01-17 11:37:14 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-01-17 10:49:01 +0000 |
commit | 187af5c7d2aab87545788f59eb8f8549e130c211 (patch) | |
tree | b576f8ac085b9e286d82a89f267fd75bc6aecb77 /src | |
parent | 22e5f2f64369ffbdcb8184c9b35c946a1d20f4e1 (diff) |
Partially revert "Optimizations for Repeater::clear() and ~QQmlItem()"
Reversing the destruction order in ~QQuickItem, and searching from the
back in removeChild() wasn't such a good idea after all, as it breaks
some assumptions people have about removing.
We'll need to find a different solution for the quadratic behaviour coming
from QQuickRepeater::clear().
This reverts parts of commit 52874a0e6f739ce410c8401e19b0a9ef6d02cabf.
Change-Id: I5a6ff9f5ddd9f0f6667142dbcc568b6aba6f8ee9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/items/qquickitem.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 54cb8be5da..af60ab879b 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -2375,8 +2375,9 @@ QQuickItem::~QQuickItem() else if (d->window) d->derefWindow(); + // XXX todo - optimize while (!d->childItems.isEmpty()) - d->childItems.constLast()->setParentItem(0); + d->childItems.constFirst()->setParentItem(0); if (!d->changeListeners.isEmpty()) { const auto listeners = d->changeListeners; // NOTE: intentional copy (QTBUG-54732) @@ -2952,8 +2953,7 @@ void QQuickItemPrivate::removeChild(QQuickItem *child) Q_ASSERT(child); Q_ASSERT(childItems.contains(child)); - int idx = childItems.lastIndexOf(child); - childItems.removeAt(idx); + childItems.removeOne(child); Q_ASSERT(!childItems.contains(child)); QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(child); |