QColorDialog::getRgba: Fixed ignoring of initial alpha value

The documentation for this method explicitly states that the initial
color+alpha is used, but its implementation used a QColor constructor
that ignores the alpha value.

Change-Id: I71721386e7fae0761e079d8840ec0124a8c14e33
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl>
This commit is contained in:
Thorbjørn Lindeijer 2016-08-26 13:25:59 +02:00 committed by Marc Mutz
parent 1e85ca2e62
commit d7d8cde4bb

View File

@ -2173,7 +2173,8 @@ QColor QColorDialog::getColor(const QColor &initial, QWidget *parent, const QStr
QRgb QColorDialog::getRgba(QRgb initial, bool *ok, QWidget *parent)
{
QColor color(getColor(QColor(initial), parent, QString(), ShowAlphaChannel));
const QColor color = getColor(QColor::fromRgba(initial), parent, QString(),
ShowAlphaChannel);
QRgb result = color.isValid() ? color.rgba() : initial;
if (ok)
*ok = color.isValid();