aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/quicktemplates2/qquickpopup.cpp3
-rw-r--r--tests/auto/controls/data/tst_popup.qml20
2 files changed, 17 insertions, 6 deletions
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index 5b10bb12..793a352e 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -199,7 +199,6 @@ void QQuickPopupPrivate::prepareEnterTransition(bool notify)
popupItem->setVisible(true);
positioner.setParentItem(parentItem);
emit q->visibleChanged();
- emit q->opened();
}
void QQuickPopupPrivate::prepareExitTransition()
@@ -215,8 +214,10 @@ void QQuickPopupPrivate::prepareExitTransition()
void QQuickPopupPrivate::finalizeEnterTransition()
{
+ Q_Q(QQuickPopup);
if (focus)
popupItem->setFocus(true);
+ emit q->opened();
}
void QQuickPopupPrivate::finalizeExitTransition(bool hide)
diff --git a/tests/auto/controls/data/tst_popup.qml b/tests/auto/controls/data/tst_popup.qml
index b28a31e8..f5b9398c 100644
--- a/tests/auto/controls/data/tst_popup.qml
+++ b/tests/auto/controls/data/tst_popup.qml
@@ -955,22 +955,32 @@ TestCase {
signalName: "closed"
}
+ Component {
+ id: pausePopup
+ Popup {
+ enter: Transition { PauseAnimation { duration: 200 } }
+ exit: Transition { PauseAnimation { duration: 200 } }
+ }
+ }
+
function test_openedClosed() {
- var control = popupControl.createObject(testCase)
+ var control = pausePopup.createObject(testCase)
verify(control)
openedSpy.target = control
closedSpy.target = control
control.open()
- tryCompare(control, "visible", true)
- compare(openedSpy.count, 1)
+ compare(control.visible, true)
+ compare(openedSpy.count, 0)
+ tryCompare(openedSpy, "count", 1)
compare(closedSpy.count, 0)
control.close()
- tryCompare(control, "visible", false)
compare(openedSpy.count, 1)
- compare(closedSpy.count, 1)
+ compare(closedSpy.count, 0)
+ tryCompare(closedSpy, "count", 1)
+ compare(control.visible, false)
control.destroy()
}