aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-02-12 09:21:50 +0100
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-02-14 09:18:47 +0100
commit5445fcac36d7122d533a2bdf0fcfe6206b7f3ff4 (patch)
treedecc2a2ebe9867511d36fb7eae9c01a8f92c93b9
parentd5a5e9dcd594e2d2f3dbb05fdb0baf56cc50774d (diff)
QQuickItemView: do not set parent to nullptr upon destruction
Setting a delegate item's parent to nullptr will make any bindings to the parent inside the item invalid, and warnings will as such be printed (first seen after 8c72e634b3b0eacbfdee883bfc34994d3c19ed77). I assume the reason for setting the (visual) parent to nullptr is to immediately hide it. So to avoid trigger any bindings, we instead just cull if from the scene graph. It's also dubious why a delegate should have bindings to its parent in the first place, since what ends up being the parent is an implementation detail, and probably not be the item the user expects it to be. Fixes: QTBUG-81976 Change-Id: I7bd8ab91461504b6e79d4aa2ab832be087245c3e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r--src/quick/items/qquickitemview.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index 7fb392233e..3e3a2c262b 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -2419,7 +2419,7 @@ void QQuickItemView::destroyingItem(QObject *object)
Q_D(QQuickItemView);
QQuickItem* item = qmlobject_cast<QQuickItem*>(object);
if (item) {
- item->setParentItem(nullptr);
+ QQuickItemPrivate::get(item)->setCulled(true);
d->unrequestedItems.remove(item);
}
}