summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2013-06-14 12:39:02 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-06-15 19:06:21 +0200
commite083aede62a23af8330bb572366e79e2f42e0cec (patch)
tree760c32913a284dc905bca46dd1edc9a4ac8dce8c
parentcf98d1e60764e22e2e3f168708818106af99c498 (diff)
Cocoa color dialog cannot be modal, but should show anyway
Silently failing doesn't seem the right way to handle this. Updated docs for DontUseNativeDialog option: it's not just for the Mac anymore. Ensure that the Qt dialog and Mac panel will never be shown at the same time. Change-Id: Ia9e80754df6c7622d9039c8dd050ac4de771a030 Task-number: QTBUG-29161 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
-rw-r--r--src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm10
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp6
2 files changed, 8 insertions, 8 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
index 514ea0482f..901aa667f5 100644
--- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
@@ -368,10 +368,8 @@ void QCocoaColorDialogHelper::exec()
bool QCocoaColorDialogHelper::show(Qt::WindowFlags, Qt::WindowModality windowModality, QWindow *parent)
{
- if (windowModality == Qt::WindowModal) {
- // Cocoa's shared color panel cannot be shown as a sheet
- return false;
- }
+ if (windowModality == Qt::WindowModal)
+ windowModality = Qt::ApplicationModal;
return showCocoaColorPanel(windowModality, parent);
}
@@ -434,9 +432,9 @@ bool QCocoaColorDialogHelper::showCocoaColorPanel(Qt::WindowModality windowModal
createNSColorPanelDelegate();
QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *>(mDelegate);
[delegate->mColorPanel setShowsAlpha:options()->testOption(QColorDialogOptions::ShowAlphaChannel)];
- if (windowModality == Qt::NonModal)
+ if (windowModality != Qt::WindowModal)
[delegate showModelessPanel];
- // no need to show a Qt::ApplicationModal dialog here, since it will be done in _q_platformRunNativeAppModalPanel()
+ // no need to show a Qt::WindowModal dialog here, because it's necessary to call exec() in that case
return true;
}
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index d6254076c5..79a71599c0 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -1776,6 +1776,8 @@ void QColorDialog::setOptions(ColorDialogOptions options)
d->options->setOptions(QColorDialogOptions::ColorDialogOptions(int(options)));
d->buttons->setVisible(!(options & NoButtons));
d->showAlpha(options & ShowAlphaChannel);
+ if (options & DontUseNativeDialog)
+ d->nativeDialogInUse = false;
}
QColorDialog::ColorDialogOptions QColorDialog::options() const
@@ -1794,8 +1796,8 @@ QColorDialog::ColorDialogOptions QColorDialog::options() const
\value ShowAlphaChannel Allow the user to select the alpha component of a color.
\value NoButtons Don't display \uicontrol{OK} and \uicontrol{Cancel} buttons. (Useful for "live dialogs".)
- \value DontUseNativeDialog Use Qt's standard color dialog on the Mac instead of Apple's
- native color panel.
+ \value DontUseNativeDialog Use Qt's standard color dialog instead of the operating system
+ native color dialog.
\sa options, setOption(), testOption(), windowModality()
*/