summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/kernel/qwindow.cpp2
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp42
2 files changed, 44 insertions, 0 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index cf4a75dfce..eb9d7a8868 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -576,6 +576,8 @@ void QWindow::setVisible(bool visible)
QGuiApplicationPrivate::showModalWindow(this);
else
QGuiApplicationPrivate::hideModalWindow(this);
+ } else if (visible && QGuiApplication::modalWindow()) {
+ QGuiApplicationPrivate::updateBlockedStatus(this);
}
#ifndef QT_NO_CURSOR
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index 92f7182249..e1366ce2eb 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -105,6 +105,7 @@ private slots:
void stateChange();
void flags();
void cleanup();
+ void testBlockingWindowShownAfterModalDialog();
private:
QPoint m_availableTopLeft;
@@ -2241,6 +2242,47 @@ void tst_QWindow::flags()
QCOMPARE(window.flags(), baseFlags | Qt::WindowStaysOnTopHint);
}
+class EventWindow : public QWindow
+{
+public:
+ EventWindow() : QWindow(), gotBlocked(false) {}
+ bool gotBlocked;
+protected:
+ bool event(QEvent *e)
+ {
+ if (e->type() == QEvent::WindowBlocked)
+ gotBlocked = true;
+ return QWindow::event(e);
+ }
+};
+
+void tst_QWindow::testBlockingWindowShownAfterModalDialog()
+{
+ EventWindow normalWindow;
+ normalWindow.setFramePosition(m_availableTopLeft + QPoint(80, 80));
+ normalWindow.resize(m_testWindowSize);
+ normalWindow.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&normalWindow));
+ QVERIFY(!normalWindow.gotBlocked);
+
+ QWindow dialog;
+ dialog.setFramePosition(m_availableTopLeft + QPoint(200, 200));
+ dialog.resize(m_testWindowSize);
+ dialog.setModality(Qt::ApplicationModal);
+ dialog.setFlags(Qt::Dialog);
+ dialog.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&dialog));
+ QVERIFY(normalWindow.gotBlocked);
+
+ EventWindow normalWindowAfter;
+ normalWindowAfter.setFramePosition(m_availableTopLeft + QPoint(80, 80));
+ normalWindowAfter.resize(m_testWindowSize);
+ QVERIFY(!normalWindowAfter.gotBlocked);
+ normalWindowAfter.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&normalWindowAfter));
+ QVERIFY(normalWindowAfter.gotBlocked);
+}
+
#include <tst_qwindow.moc>
QTEST_MAIN(tst_QWindow)