From ad1bd1563f3f65d0f7b65687af2ade42f7f9f3d9 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Wed, 28 Mar 2012 15:26:17 +0200 Subject: Implement window modality in QtGui MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Lars Knoll Reviewed-by: Samuel Rødal Reviewed-by: Morten Johan Sørvig --- src/gui/kernel/qguiapplication.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gui/kernel/qguiapplication.h') 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 -- cgit v1.2.3 From d80b00f3206291dc90433a95bd6c6aadc17be0bb Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Fri, 13 Apr 2012 09:39:15 -0700 Subject: Fix header inclusion guards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _QPA_ should only be used for qpa (plugin specific api) files. Change-Id: I1fb6cd5973fcabec4c7e87eb6ccb048f825e2aad Reviewed-by: Holger Freyther Reviewed-by: Samuel Rødal --- src/gui/kernel/qguiapplication.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/gui/kernel/qguiapplication.h') diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h index aad540d203..8ae0e6dfc5 100644 --- a/src/gui/kernel/qguiapplication.h +++ b/src/gui/kernel/qguiapplication.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QGUIAPPLICATION_QPA_H -#define QGUIAPPLICATION_QPA_H +#ifndef QGUIAPPLICATION_H +#define QGUIAPPLICATION_H #include #include @@ -170,4 +170,4 @@ QT_END_NAMESPACE QT_END_HEADER -#endif // QGUIAPPLICATION_QPA_H +#endif // QGUIAPPLICATION_H -- cgit v1.2.3