Cocoa: use specified window modality in native print dialogs
authorBradley T. Hughes <bradley.hughes@nokia.com>
Fri, 30 Mar 2012 08:11:48 +0000 (10:11 +0200)
committerQt by Nokia <qt-info@nokia.com>
Thu, 12 Apr 2012 02:15:35 +0000 (04:15 +0200)
Don't pick the modality type based on the presences of a parent widget,
use QWidget::windowModality() instead. If modality hasn't been
specified, then use presence of the parent to chose an appropriate
modality type.

Change-Id: Ib39c166ba3293174c55748f63222367e3e1c56bc
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
src/printsupport/dialogs/qpagesetupdialog_mac.mm
src/printsupport/dialogs/qprintdialog_mac.mm

index e387a58..1dded4f 100644 (file)
@@ -179,8 +179,12 @@ void QPageSetupDialog::setVisible(bool visible)
     QDialog::setVisible(visible);
 
     if (visible) {
-        d->openCocoaPageLayout(parentWidget() ? Qt::WindowModal
-                                              : Qt::ApplicationModal);
+        Qt::WindowModality modality = windowModality();
+        if (modality == Qt::NonModal) {
+            // NSPrintPanels can only be modal, so we must pick a type
+            modality = parentWidget() ? Qt::WindowModal : Qt::ApplicationModal;
+        }
+        d->openCocoaPageLayout(modality);
         return;
     } else {
         if (d->pageLayout) {
index 8ea3c9a..e1d85ee 100644 (file)
@@ -296,8 +296,12 @@ void QPrintDialog::setVisible(bool visible)
     QDialog::setVisible(visible);
 
     if (visible) {
-        d->openCocoaPrintPanel(parentWidget() ? Qt::WindowModal
-                                              : Qt::ApplicationModal);
+        Qt::WindowModality modality = windowModality();
+        if (modality == Qt::NonModal) {
+            // NSPrintPanels can only be modal, so we must pick a type
+            modality = parentWidget() ? Qt::WindowModal : Qt::ApplicationModal;
+        }
+        d->openCocoaPrintPanel(modality);
         return;
     } else {
         if (d->printPanel) {