Cocoa color dialog: Make sure hide() exits the modal session

Change-Id: I708011f3a8ce507e6ade98bf99ad0f5d7b160751
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
bb10
Gabriel de Dietrich 2013-07-05 16:40:55 +02:00 committed by The Qt Project
parent 2713a4534b
commit c92d1d8acd
1 changed files with 8 additions and 1 deletions

View File

@ -295,6 +295,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate);
// close down during the cleanup.
qApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers);
[NSApp runModalForWindow:mColorPanel];
mDialogIsExecuting = false;
return (mResultCode == NSOKButton);
}
@ -384,7 +385,13 @@ void QCocoaColorDialogHelper::hide()
{
if (!mDelegate)
return;
[reinterpret_cast<QNSColorPanelDelegate *>(mDelegate)->mColorPanel close];
QNSColorPanelDelegate *delegate = static_cast<QNSColorPanelDelegate *>(mDelegate);
if (![delegate->mColorPanel isVisible])
return;
if (delegate->mDialogIsExecuting)
[delegate->mColorPanel performClose:delegate];
else
[delegate->mColorPanel close];
}
void QCocoaColorDialogHelper::setCurrentColor(const QColor &color)