diff options
-rw-r--r-- | src/quicktemplates2/qquickpopup.cpp | 2 | ||||
-rw-r--r-- | tests/auto/drawer/tst_drawer.cpp | 25 |
2 files changed, 26 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp index 0f773629..c79b3ff8 100644 --- a/src/quicktemplates2/qquickpopup.cpp +++ b/src/quicktemplates2/qquickpopup.cpp @@ -231,8 +231,8 @@ void QQuickPopupPrivate::finalizeEnterTransition() void QQuickPopupPrivate::finalizeExitTransition(bool hide) { Q_Q(QQuickPopup); - positioner.setParentItem(nullptr); if (hide) { + positioner.setParentItem(nullptr); popupItem->setParentItem(nullptr); popupItem->setVisible(false); } diff --git a/tests/auto/drawer/tst_drawer.cpp b/tests/auto/drawer/tst_drawer.cpp index 6a19af91..062b430a 100644 --- a/tests/auto/drawer/tst_drawer.cpp +++ b/tests/auto/drawer/tst_drawer.cpp @@ -56,6 +56,8 @@ private slots: void dragMargin_data(); void dragMargin(); + + void reposition(); }; void tst_Drawer::position_data() @@ -150,6 +152,29 @@ void tst_Drawer::dragMargin() QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(window->width() - drawer->width() * 0.75, drawer->height() / 2)); } +void tst_Drawer::reposition() +{ + QQuickApplicationHelper helper(this, QStringLiteral("applicationwindow.qml")); + + QQuickApplicationWindow *window = helper.window; + window->show(); + window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); + + QQuickDrawer *drawer = helper.window->property("drawer").value<QQuickDrawer*>(); + QVERIFY(drawer); + drawer->setEdge(Qt::RightEdge); + + drawer->open(); + QTRY_COMPARE(drawer->popupItem()->x(), window->width() - drawer->width()); + + drawer->close(); + QTRY_COMPARE(drawer->popupItem()->x(), static_cast<qreal>(window->width())); + + window->setWidth(window->width() + 100); + QTRY_COMPARE(drawer->popupItem()->x(), static_cast<qreal>(window->width())); +} + QTEST_MAIN(tst_Drawer) #include "tst_drawer.moc" |