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>
This commit is contained in:
parent
cf98d1e607
commit
e083aede62
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user