From cf98d1e60764e22e2e3f168708818106af99c498 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 13 Jun 2013 17:50:39 +0200 Subject: OSX color dialog can be accepted repeatedly QNSColorPanelDelegate::finishOffWithCode sets mResultSet = true and it needs to be set false again the next time the dialog is shown. Task-number: QTBUG-31566 Change-Id: If1d4bb9d4e76273c6423f5bf2ae37790e8a9704e Reviewed-by: Liang Qi --- src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm | 1 + 1 file changed, 1 insertion(+) (limited to 'src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm') diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm index a0dac445be..514ea0482f 100644 --- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm @@ -274,6 +274,7 @@ static NSButton *macCreateButton(const char *text, NSView *superview) - (void)showModelessPanel { mDialogIsExecuting = false; + mResultSet = false; [mColorPanel makeKeyAndOrderFront:mColorPanel]; } -- cgit v1.2.3 From e083aede62a23af8330bb572366e79e2f42e0cec Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 14 Jun 2013 12:39:02 +0200 Subject: 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 --- src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm') 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(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; } -- cgit v1.2.3 From 69554e458669c941130c2dc03d42a59ffd00e39e Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 14 Jun 2013 12:39:42 +0200 Subject: OSX: Disable window restoration for the Mac color panel because if it is automatically restored it's out of the application's control, so the user's interaction will be ignored. Change I8ce3cd94f5ae81d7877a346743ca4e0e188baa02 did this for normal windows by default, but the dialog helpers generate windows which aren't affected by that. Task-number: QTBUG-31750 Change-Id: I636bd87b664a489a2dc8693dad5370a715b1cf7b Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm') diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm index 901aa667f5..594ad65a18 100644 --- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm @@ -98,6 +98,11 @@ static NSButton *macCreateButton(const char *text, NSView *superview) mDialogIsExecuting = false; mResultSet = false; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 + if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) + [mColorPanel setRestorable:NO]; +#endif + if (mHelper->options()->testOption(QColorDialogOptions::NoButtons)) { mStolenContentView = 0; mOkButton = 0; -- cgit v1.2.3