QColor: add casts to ushort

Silence lossy conversion warnings on MSVC.

Task-number: QTBUG-80997
Change-Id: I0e5778b9f20b599de6fc8894c4b98fbc1b1510b9
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
Giuseppe D'Angelo 2020-01-16 11:18:21 +01:00
parent 5dc16d1324
commit a3b2eac380

View File

@ -72,10 +72,10 @@ public:
QColor(Qt::GlobalColor color) noexcept;
Q_DECL_CONSTEXPR QColor(int r, int g, int b, int a = 255) noexcept
: cspec(isRgbaValid(r, g, b, a) ? Rgb : Invalid),
ct(cspec == Rgb ? a * 0x0101 : 0,
cspec == Rgb ? r * 0x0101 : 0,
cspec == Rgb ? g * 0x0101 : 0,
cspec == Rgb ? b * 0x0101 : 0,
ct(ushort(cspec == Rgb ? a * 0x0101 : 0),
ushort(cspec == Rgb ? r * 0x0101 : 0),
ushort(cspec == Rgb ? g * 0x0101 : 0),
ushort(cspec == Rgb ? b * 0x0101 : 0),
0) {}
QColor(QRgb rgb) noexcept;
QColor(QRgba64 rgba64) noexcept;