From b46189c3c3a92c9093bd05bf976b2e7a368511a3 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Thu, 26 Apr 2012 13:32:14 +0200 Subject: Support all modality types in QPlatformDialogHelper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modality is not a boolean property in Qt. There are 2 types: window modality and application modality. Native dialogs can support both of these types as well (e.g. on Cocoa, a window modal file dialog should be displayed as a Sheet). Remove the QPlatformDialogHelper::ShowFlags enum and instead pass a Qt::WindowModality parameter to QPlatformDialogHelper::show_sys(). The Windows implementation has been updated to check for Qt::ApplicationModal instead of the ShowModal flag (since only Qt::ApplicationModal dialogs are blocking). The Cocoa implementation has been updated to only use non-modal and application modal native color and font dialogs (which restores Qt 4 behavior). These are shared Cocoa panels that cannot be shown as sheets, however. If the programmer asks for window modal color/font dialogs, we use the Qt versions, not the native ones. The file dialog can be shown either as a Sheet (but we need to pass an NSWindow parent for it to work properly) or as an application modal dialog. This change has been tested on Mac OS X with tests/manual/windowmodality. Change-Id: I9064987433895c55f68aac979ef8e8207fb24bbe Reviewed-by: Friedemann Kleint Reviewed-by: Morten Johan Sørvig --- src/gui/kernel/qplatformdialoghelper_qpa.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/gui/kernel/qplatformdialoghelper_qpa.h') diff --git a/src/gui/kernel/qplatformdialoghelper_qpa.h b/src/gui/kernel/qplatformdialoghelper_qpa.h index 80a9f0efaf..5cd3ab055b 100644 --- a/src/gui/kernel/qplatformdialoghelper_qpa.h +++ b/src/gui/kernel/qplatformdialoghelper_qpa.h @@ -84,11 +84,6 @@ public: SnapToDefaultButton }; enum DialogCode { Rejected, Accepted }; - enum ShowFlag { - ShowModal = 0x00000001 - }; - - Q_DECLARE_FLAGS(ShowFlags, ShowFlag) QPlatformDialogHelper(); virtual ~QPlatformDialogHelper(); @@ -99,8 +94,8 @@ public: virtual void _q_platformRunNativeAppModalPanel() = 0; virtual void deleteNativeDialog_sys() = 0; - virtual bool show_sys(ShowFlags showFlags, - Qt::WindowFlags windowFlags, + virtual bool show_sys(Qt::WindowFlags windowFlags, + Qt::WindowModality windowModality, QWindow *parent) = 0; virtual void hide_sys() = 0; -- cgit v1.2.3