From ac02a71a9cb8e80014218ba7de46f4f914b6e00c Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 30 May 2017 09:11:28 +0200 Subject: Revert "QQuickWindow::createTextureFromImage(): return nullptr for null images" This reverts commit e6acf80136db9f667d0d4664f6c68065355d6811. This breaks behavioral compatibility. Task-number: QTBUG-61083 Change-Id: I0161d536502bab31aaf4ebc38f91e6c8842f72b0 Reviewed-by: Laszlo Agocs --- tests/auto/quick/qquickwindow/tst_qquickwindow.cpp | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'tests/auto/quick/qquickwindow/tst_qquickwindow.cpp') diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp index 639027d668..1d6547c5be 100644 --- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp +++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp @@ -375,8 +375,6 @@ private slots: void testDragEventPropertyPropagation(); - void createTextureFromImage(); - private: QTouchDevice *touchDevice; QTouchDevice *touchDeviceWithVelocity; @@ -2833,15 +2831,6 @@ void tst_qquickwindow::testDragEventPropertyPropagation() } } -void tst_qquickwindow::createTextureFromImage() -{ - // An invalid image should return a null pointer. - QQuickWindow window; - window.show(); - QTest::qWaitForWindowExposed(&window); - QVERIFY(!window.createTextureFromImage(QImage())); -} - QTEST_MAIN(tst_qquickwindow) #include "tst_qquickwindow.moc" -- cgit v1.2.3 From af6655885cf19de69d5f57ac9daee9f6b9935a70 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 1 Jun 2017 10:48:00 +0200 Subject: QQuickWindow/View: set a QObject-parent on the root item People are often confused why eg. the objects from: window->contentItem()->findChildren() are not included in window->findChildren(). This change connects the item tree to the window's object tree to make findChild() and findChildren() produce expected results. The same technique is already used for QQuickFlickable's contentItem. [ChangeLog][QtQuick][QQuickWindow] Set the window as the QObject-parent of the contentItem to ensure consistent behavior for calling findChildren() on QQuickWindow and QQuickWindow::contentItem. [ChangeLog][QtQuick][QQuickView] Set the window's contentItem as the QObject-parent of the rootObject to ensure consistent behavior for calling findChildren() on QQuickWindow::contentItem and QQuickView::rootObject. Change-Id: Idb7834eb5e560088ca849e6ce90e6fa3b3ae3e91 Reviewed-by: Mitch Curtis --- tests/auto/quick/qquickwindow/tst_qquickwindow.cpp | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests/auto/quick/qquickwindow/tst_qquickwindow.cpp') diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp index 1d6547c5be..daa5e53730 100644 --- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp +++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp @@ -375,6 +375,8 @@ private slots: void testDragEventPropertyPropagation(); + void findChild(); + private: QTouchDevice *touchDevice; QTouchDevice *touchDeviceWithVelocity; @@ -2831,6 +2833,28 @@ void tst_qquickwindow::testDragEventPropertyPropagation() } } +void tst_qquickwindow::findChild() +{ + QQuickWindow window; + + // QQuickWindow + // |_ QQuickWindow::contentItem + // | |_ QObject("contentItemChild") + // |_ QObject("viewChild") + + QObject *windowChild = new QObject(&window); + windowChild->setObjectName("windowChild"); + + QObject *contentItemChild = new QObject(window.contentItem()); + contentItemChild->setObjectName("contentItemChild"); + + QCOMPARE(window.findChild("windowChild"), windowChild); + QCOMPARE(window.findChild("contentItemChild"), contentItemChild); + + QVERIFY(!window.contentItem()->findChild("viewChild")); // sibling + QCOMPARE(window.contentItem()->findChild("contentItemChild"), contentItemChild); +} + QTEST_MAIN(tst_qquickwindow) #include "tst_qquickwindow.moc" -- cgit v1.2.3