Keep QColorDialog::ShowAlphaChannel from expanding the dialog on OS X.

Workaround for Apple rdar://25792119: If you invoke -setShowsAlpha:
multiple times before showing the color picker, its height grows
irrevocably.  Instead, only invoke it once, when we show the dialog.

Task-number: QTBUG-44620
Change-Id: I8ffc803b4216cdb466a651951f9f987a7b6c1f2e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Steve Mokris 2016-04-16 16:47:57 -04:00
parent 6dfc3541e6
commit 2a995c77d4

View File

@ -132,7 +132,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate);
- (void)setDialogHelper:(QCocoaColorDialogHelper *)helper
{
mHelper = helper;
[mColorPanel setShowsAlpha:mHelper->options()->testOption(QColorDialogOptions::ShowAlphaChannel)];
if (mHelper->options()->testOption(QColorDialogOptions::NoButtons)) {
[self restoreOriginalContentView];
} else if (!mStolenContentView) {
@ -483,6 +483,14 @@ bool QCocoaColorDialogHelper::show(Qt::WindowFlags, Qt::WindowModality windowMod
{
if (windowModality == Qt::WindowModal)
windowModality = Qt::ApplicationModal;
// Workaround for Apple rdar://25792119: If you invoke
// -setShowsAlpha: multiple times before showing the color
// picker, its height grows irrevocably. Instead, only
// invoke it once, when we show the dialog.
[[NSColorPanel sharedColorPanel] setShowsAlpha:
options()->testOption(QColorDialogOptions::ShowAlphaChannel)];
sharedColorPanel()->init(this);
return sharedColorPanel()->show(windowModality, parent);
}