Cocoa: fix setting color with alpha channel value for color dialog
Make sure that if ShowAlphaChannel option is set then also setShowsAlpha needs to be set for the panel before setting the current color, otherwise alpha channel value is omitted. Task-number: QTBUG-24320 Change-Id: Ifb3822711af8ffd0cf6cb4c8aab2b0020d296663 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
This commit is contained in:
parent
91c44fd31e
commit
89b5244310
@ -404,6 +404,11 @@ void QCocoaColorDialogHelper::setCurrentColor_sys(const QColor &color)
|
|||||||
if (!mDelegate)
|
if (!mDelegate)
|
||||||
createNSColorPanelDelegate();
|
createNSColorPanelDelegate();
|
||||||
QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *>(mDelegate);
|
QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *>(mDelegate);
|
||||||
|
|
||||||
|
// make sure that if ShowAlphaChannel option is set then also setShowsAlpha
|
||||||
|
// needs to be set, otherwise alpha value is omitted
|
||||||
|
[delegate->mColorPanel setShowsAlpha:options()->testOption(QColorDialogOptions::ShowAlphaChannel)];
|
||||||
|
|
||||||
NSColor *nsColor;
|
NSColor *nsColor;
|
||||||
const QColor::Spec spec = color.spec();
|
const QColor::Spec spec = color.spec();
|
||||||
if (spec == QColor::Cmyk) {
|
if (spec == QColor::Cmyk) {
|
||||||
|
@ -156,9 +156,6 @@ void tst_QColorDialog::task247349_alpha()
|
|||||||
dialog.setOption(QColorDialog::ShowAlphaChannel, true);
|
dialog.setOption(QColorDialog::ShowAlphaChannel, true);
|
||||||
int alpha = 0x17;
|
int alpha = 0x17;
|
||||||
dialog.setCurrentColor(QColor(0x01, 0x02, 0x03, alpha));
|
dialog.setCurrentColor(QColor(0x01, 0x02, 0x03, alpha));
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
QEXPECT_FAIL("", "Fails on Mac OS X, see QTBUG-24320", Abort);
|
|
||||||
#endif
|
|
||||||
QCOMPARE(alpha, dialog.currentColor().alpha());
|
QCOMPARE(alpha, dialog.currentColor().alpha());
|
||||||
QCOMPARE(alpha, qAlpha(dialog.currentColor().rgba()));
|
QCOMPARE(alpha, qAlpha(dialog.currentColor().rgba()));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user