summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qguiapplication.h
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2012-03-28 15:26:17 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-11 16:17:59 +0200
commitad1bd1563f3f65d0f7b65687af2ade42f7f9f3d9 (patch)
treecaf53878e581afa44a53458dc5bcc23ea5eea972 /src/gui/kernel/qguiapplication.h
parenteff344ab8a509996cab491347aed4a4d8ea5b2ab (diff)
Implement window modality in QtGui
QWindow already has windowModality() and setWindowModality() as part of its API from commit 516f4e283ba4626d7239630397ef867ab0366071. Platform plugins can use this already to setup modality hints on windows that they create, but it's not enough to implement modality fully. QGuiApplication gets a modalWindow() static method, which is similar to QApplication::activeModalWidget() in that it returns the last modal window to be shown. The modal window "stack" moves from QApplicationPrivate to QGuiApplicationPrivate. The enterModal*() and leaveModal*() functions in QApplicationPrivate are removed and replaced by QGuiApplicationPrivate::showModalWindow() and hideModalWindow(), which are called by QWindow::setVisible() just before calling QPlatformWindow::setVisible(). The virtual QGuiApplicationPrivate::isWindowBlocked() will tell us if a window is blocked by a modal window (and tell which modal window for any interested callers). The default implementation works on the QWindow level. QApplicationPrivate reimplements isWindowBlocked() and adds popup and WA_GroupLeader support. QGuiApplication uses the state set from isWindowBlocked() to block user-input events: mouse press, mouse move, mouse release, wheel, key presses, key releases, enter/leave events, close events, and touch begin, update, and end events. Note also that the modality helper functions in QtWidgets and QApplicationPrivate are left in place and working as they always have. The behavior of QWidget in the presence of modal windows/dialogs should not change. Change-Id: I2c89e6026d40160387787a6e009ae1fdc12dfd69 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/gui/kernel/qguiapplication.h')
-rw-r--r--src/gui/kernel/qguiapplication.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
index b58720db13..aad540d203 100644
--- a/src/gui/kernel/qguiapplication.h
+++ b/src/gui/kernel/qguiapplication.h
@@ -88,6 +88,8 @@ public:
static QString platformName();
+ static QWindow *modalWindow();
+
#ifdef QT_DEPRECATED
static QT_DEPRECATED QWindow *activeWindow() { return focusWindow(); }
#endif