From 39540124dd0900e0c99dcda8c0ebdf4f3cea8d5e Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 3 Jan 2014 10:38:33 +0100 Subject: Fix interaction of QQuickItems with the garbage collector The QObject ownership of QQuickItem objects is not accessible / mutable in QML, because the parent property maps to the (dynamic) visual parent. There are use-cases of creating QQuickItem objects without a QObject parent and to support this, the visual parent needs to mark its visual children in order to provide intuitive semantics. [ChangeLog][QtQuick][Import Behavior Changes] A QQuick Item is now strongly referenced by its visual parent item, so it doesn't require a QObject parent to stay alive. Task-number: QTBUG-35913 Change-Id: Ief2d40ac76298a0cf241ca73ff654c4ecfa12748 Reviewed-by: Lars Knoll --- tests/auto/quick/qquickitem/data/visualParentOwnership.qml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/auto/quick/qquickitem/data/visualParentOwnership.qml (limited to 'tests/auto/quick/qquickitem/data') diff --git a/tests/auto/quick/qquickitem/data/visualParentOwnership.qml b/tests/auto/quick/qquickitem/data/visualParentOwnership.qml new file mode 100644 index 0000000000..644d14ba43 --- /dev/null +++ b/tests/auto/quick/qquickitem/data/visualParentOwnership.qml @@ -0,0 +1,14 @@ +import QtQuick 2.0 + +Item { + Component { + id: factory + Item {} + } + + property Item keepAliveProperty; + + function createItemWithoutParent() { + return factory.createObject(/*parent*/ null); + } +} -- cgit v1.2.3