From a2e92f6dee12320a58a4bcc95c14649b27804427 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 3 Feb 2014 17:36:55 +0100 Subject: Dynamic GL in Quick MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The counterpart to I716fdebb. Implements the dynamic path in scenegraph. Task-number: QTBUG-36483 Change-Id: I2dc613ba84560b7b8e36d3cd1da61c050ab08db0 Reviewed-by: Friedemann Kleint Reviewed-by: Jørgen Lind --- tests/auto/quick/qquickitem/tst_qquickitem.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests/auto/quick/qquickitem') diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp index f4f2374183..a1d9d0c73b 100644 --- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp @@ -1188,8 +1188,9 @@ static inline QByteArray msgItem(const QQuickItem *item) void tst_qquickitem::mouseGrab() { -#if defined(Q_OS_WIN) && defined(QT_OPENGL_ES_2) - QSKIP("Fails in the CI for ANGLE builds on Windows, QTBUG-32664"); +#ifdef Q_OS_WIN + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::GLES2) + QSKIP("Fails in the CI for ANGLE builds on Windows, QTBUG-32664"); #endif QQuickWindow window; window.setFramePosition(QPoint(100, 100)); -- cgit v1.2.3 From 8b371173c4fed7df453a0e352af54e3363709d4b Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 28 Mar 2014 18:41:26 +0100 Subject: Fix visual parent ownership with scenes that create windows Commit 39540124dd0900e0c99dcda8c0ebdf4f3cea8d5e introduced the concept that a visual parent marks its children, by recursively marking the children of the root item in a QQuickView. This allowed for the removal of an ugly hack in QtQuick Controls. Unfortunately that fix is incomplete in the sense that it makes the incorrect assumption that a QQuickView is always used. The use-case in the bug report is to have child items inside a QtQuick.Window (a regular ApplicationWindow in fact). That window - implemented by QQuickWindowQmlImpl - also needs to mark its children, so this patch introduces the use of the same GC marking helper class (which now operates on a QQuickWindow instead of a QQuickViewPrivate). Task-number: QTBUG-37711 Change-Id: Id788e84dbb041ac8ba6ff23dc4ef56f6fe9e465a Reviewed-by: Lars Knoll --- .../data/visualParentOwnershipWindow.qml | 15 ++++++ tests/auto/quick/qquickitem/tst_qquickitem.cpp | 58 ++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 tests/auto/quick/qquickitem/data/visualParentOwnershipWindow.qml (limited to 'tests/auto/quick/qquickitem') diff --git a/tests/auto/quick/qquickitem/data/visualParentOwnershipWindow.qml b/tests/auto/quick/qquickitem/data/visualParentOwnershipWindow.qml new file mode 100644 index 0000000000..30fc844d7a --- /dev/null +++ b/tests/auto/quick/qquickitem/data/visualParentOwnershipWindow.qml @@ -0,0 +1,15 @@ +import QtQuick 2.0 +import QtQuick.Window 2.1 + +Window { + Component { + id: factory + Item {} + } + + property Item keepAliveProperty; + + function createItemWithoutParent() { + return factory.createObject(/*parent*/ null); + } +} diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp index a1d9d0c73b..6f11986e20 100644 --- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp @@ -169,6 +169,7 @@ private slots: void acceptedMouseButtons(); void visualParentOwnership(); + void visualParentOwnershipWindow(); private: @@ -1821,6 +1822,63 @@ void tst_qquickitem::visualParentOwnership() } } +void tst_qquickitem::visualParentOwnershipWindow() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("visualParentOwnershipWindow.qml")); + + QQuickWindow *window = qobject_cast(component.create()); + QVERIFY(window); + QQuickItem *root = window->contentItem(); + + QVariant newObject; + { + QVERIFY(QMetaObject::invokeMethod(window, "createItemWithoutParent", Q_RETURN_ARG(QVariant, newObject))); + QPointer newItem = qvariant_cast(newObject); + QVERIFY(!newItem.isNull()); + + QVERIFY(!newItem->parent()); + QVERIFY(!newItem->parentItem()); + + newItem->setParentItem(root); + + gc(engine); + + QVERIFY(!newItem.isNull()); + newItem->setParentItem(0); + + gc(engine); + QVERIFY(newItem.isNull()); + } + { + QVERIFY(QMetaObject::invokeMethod(window, "createItemWithoutParent", Q_RETURN_ARG(QVariant, newObject))); + QPointer firstItem = qvariant_cast(newObject); + QVERIFY(!firstItem.isNull()); + + firstItem->setParentItem(root); + + QVERIFY(QMetaObject::invokeMethod(window, "createItemWithoutParent", Q_RETURN_ARG(QVariant, newObject))); + QPointer secondItem = qvariant_cast(newObject); + QVERIFY(!firstItem.isNull()); + + secondItem->setParentItem(firstItem); + + gc(engine); + + delete firstItem; + + window->setProperty("keepAliveProperty", newObject); + + gc(engine); + QVERIFY(!secondItem.isNull()); + + window->setProperty("keepAliveProperty", QVariant()); + + gc(engine); + QVERIFY(secondItem.isNull()); + } +} + QTEST_MAIN(tst_qquickitem) #include "tst_qquickitem.moc" -- cgit v1.2.3 From 50d7c049e3310d4d9194c2efb5150e4e5a50e5ca Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 24 Apr 2014 17:14:41 +0200 Subject: Follow QOpenGLContext API renaming Task-number: QTBUG-38564 Change-Id: Ice1170339f7d650fcb6accfccf325471629343d6 Reviewed-by: Sean Harmer --- tests/auto/quick/qquickitem/tst_qquickitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto/quick/qquickitem') diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp index 6f11986e20..2db510a69e 100644 --- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp @@ -1190,7 +1190,7 @@ static inline QByteArray msgItem(const QQuickItem *item) void tst_qquickitem::mouseGrab() { #ifdef Q_OS_WIN - if (QOpenGLContext::openGLModuleType() == QOpenGLContext::GLES2) + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES) QSKIP("Fails in the CI for ANGLE builds on Windows, QTBUG-32664"); #endif QQuickWindow window; -- cgit v1.2.3