diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-08-12 14:14:02 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-08-14 15:52:58 +0200 |
commit | 6f0df02d002356625f10683ef84da7685d92a2c4 (patch) | |
tree | 46713209af459ebda534c3404f48c5f5c80ba3f8 /src/gui/painting/qcolor.h | |
parent | 44cce1a2ea9dadd8b2de93f40de34269dda703c0 (diff) |
Replace Qt CONSTEXPR defines with constexpr
Both normal and relaxed constexpr are required by our new minimum of
C++17.
Change-Id: Ic028b88a2e7a6cb7d5925f3133b9d54859a81744
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Diffstat (limited to 'src/gui/painting/qcolor.h')
-rw-r--r-- | src/gui/painting/qcolor.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h index 683826fbe7..dbced35996 100644 --- a/src/gui/painting/qcolor.h +++ b/src/gui/painting/qcolor.h @@ -69,10 +69,10 @@ public: enum Spec { Invalid, Rgb, Hsv, Cmyk, Hsl, ExtendedRgb }; enum NameFormat { HexRgb, HexArgb }; - Q_DECL_CONSTEXPR QColor() noexcept + constexpr QColor() noexcept : cspec(Invalid), ct(USHRT_MAX, 0, 0, 0, 0) {} QColor(Qt::GlobalColor color) noexcept; - Q_DECL_CONSTEXPR QColor(int r, int g, int b, int a = 255) noexcept + constexpr QColor(int r, int g, int b, int a = 255) noexcept : cspec(isRgbaValid(r, g, b, a) ? Rgb : Invalid), ct(ushort(cspec == Rgb ? a * 0x0101 : 0), ushort(cspec == Rgb ? r * 0x0101 : 0), @@ -235,7 +235,7 @@ private: template <typename String> bool setColorFromString(String name); - static Q_DECL_CONSTEXPR bool isRgbaValid(int r, int g, int b, int a = 255) noexcept Q_DECL_CONST_FUNCTION + static constexpr bool isRgbaValid(int r, int g, int b, int a = 255) noexcept Q_DECL_CONST_FUNCTION { return uint(r) <= 255 && uint(g) <= 255 && uint(b) <= 255 && uint(a) <= 255; } @@ -244,7 +244,7 @@ private: union CT { #ifdef Q_COMPILER_UNIFORM_INIT CT() {} // doesn't init anything, thus can't be constexpr - Q_DECL_CONSTEXPR explicit CT(ushort a1, ushort a2, ushort a3, ushort a4, ushort a5) noexcept + constexpr explicit CT(ushort a1, ushort a2, ushort a3, ushort a4, ushort a5) noexcept : array{a1, a2, a3, a4, a5} {} #endif struct { @@ -293,7 +293,7 @@ private: #ifdef Q_COMPILER_UNIFORM_INIT public: // can't give friendship to a namespace, so it needs to be public - Q_DECL_CONSTEXPR explicit QColor(Spec spec, ushort a1, ushort a2, ushort a3, ushort a4, ushort a5=0) noexcept + constexpr explicit QColor(Spec spec, ushort a1, ushort a2, ushort a3, ushort a4, ushort a5=0) noexcept : cspec(spec), ct(a1, a2, a3, a4, a5) {} #endif // Q_COMPILER_UNIFORM_INIT }; |