diff options
Diffstat (limited to 'src/gui/painting/qcolor.h')
-rw-r--r-- | src/gui/painting/qcolor.h | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h index 06c218365b..b0192662cc 100644 --- a/src/gui/painting/qcolor.h +++ b/src/gui/painting/qcolor.h @@ -37,6 +37,7 @@ #include <QtGui/qrgb.h> #include <QtCore/qnamespace.h> #include <QtCore/qstringlist.h> +#include <QtGui/qrgba64.h> QT_BEGIN_NAMESPACE @@ -63,11 +64,23 @@ public: QColor(Qt::GlobalColor color); QColor(int r, int g, int b, int a = 255); QColor(QRgb rgb); + QColor(QRgba64 rgba64); QColor(const QString& name); QColor(const char *name); - QColor(const QColor &color); // ### Qt 6: remove, the trivial one is fine. QColor(Spec spec); +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) + QColor(const QColor &color); // ### Qt 6: remove all of these, the trivial ones are fine. +# ifdef Q_COMPILER_RVALUE_REFS + QColor(QColor &&other) Q_DECL_NOTHROW : cspec(other.cspec), ct(other.ct) {} + QColor &operator=(QColor &&other) Q_DECL_NOTHROW + { cspec = other.cspec; ct = other.ct; return *this; } +# endif + QColor &operator=(const QColor &); +#endif // Qt < 6 + + QColor &operator=(Qt::GlobalColor color); + bool isValid() const; // ### Qt 6: merge overloads @@ -100,15 +113,18 @@ public: void setGreenF(qreal green); void setBlueF(qreal blue); - void getRgb(int *r, int *g, int *b, int *a = 0) const; + void getRgb(int *r, int *g, int *b, int *a = Q_NULLPTR) const; void setRgb(int r, int g, int b, int a = 255); - void getRgbF(qreal *r, qreal *g, qreal *b, qreal *a = 0) const; + void getRgbF(qreal *r, qreal *g, qreal *b, qreal *a = Q_NULLPTR) const; void setRgbF(qreal r, qreal g, qreal b, qreal a = 1.0); QRgb rgba() const; void setRgba(QRgb rgba); + QRgba64 rgba64() const; + void setRgba64(QRgba64 rgba); + QRgb rgb() const; void setRgb(QRgb rgb); @@ -124,10 +140,10 @@ public: qreal hsvSaturationF() const; qreal valueF() const; - void getHsv(int *h, int *s, int *v, int *a = 0) const; + void getHsv(int *h, int *s, int *v, int *a = Q_NULLPTR) const; void setHsv(int h, int s, int v, int a = 255); - void getHsvF(qreal *h, qreal *s, qreal *v, qreal *a = 0) const; + void getHsvF(qreal *h, qreal *s, qreal *v, qreal *a = Q_NULLPTR) const; void setHsvF(qreal h, qreal s, qreal v, qreal a = 1.0); int cyan() const; @@ -140,10 +156,10 @@ public: qreal yellowF() const; qreal blackF() const; - void getCmyk(int *c, int *m, int *y, int *k, int *a = 0); + void getCmyk(int *c, int *m, int *y, int *k, int *a = Q_NULLPTR); void setCmyk(int c, int m, int y, int k, int a = 255); - void getCmykF(qreal *c, qreal *m, qreal *y, qreal *k, qreal *a = 0); + void getCmykF(qreal *c, qreal *m, qreal *y, qreal *k, qreal *a = Q_NULLPTR); void setCmykF(qreal c, qreal m, qreal y, qreal k, qreal a = 1.0); int hslHue() const; // 0 <= hue < 360 @@ -154,10 +170,10 @@ public: qreal hslSaturationF() const; qreal lightnessF() const; - void getHsl(int *h, int *s, int *l, int *a = 0) const; + void getHsl(int *h, int *s, int *l, int *a = Q_NULLPTR) const; void setHsl(int h, int s, int l, int a = 255); - void getHslF(qreal *h, qreal *s, qreal *l, qreal *a = 0) const; + void getHslF(qreal *h, qreal *s, qreal *l, qreal *a = Q_NULLPTR) const; void setHslF(qreal h, qreal s, qreal l, qreal a = 1.0); QColor toRgb() const; @@ -173,6 +189,9 @@ public: static QColor fromRgb(int r, int g, int b, int a = 255); static QColor fromRgbF(qreal r, qreal g, qreal b, qreal a = 1.0); + static QColor fromRgba64(ushort r, ushort g, ushort b, ushort a = USHRT_MAX); + static QColor fromRgba64(QRgba64 rgba); + static QColor fromHsv(int h, int s, int v, int a = 255); static QColor fromHsvF(qreal h, qreal s, qreal v, qreal a = 1.0); @@ -187,9 +206,6 @@ public: QColor dark(int f = 200) const Q_REQUIRED_RESULT; QColor darker(int f = 200) const Q_REQUIRED_RESULT; - QColor &operator=(const QColor &); - QColor &operator=(Qt::GlobalColor color); - bool operator==(const QColor &c) const; bool operator!=(const QColor &c) const; @@ -254,9 +270,11 @@ inline QColor::QColor(const char *aname) inline QColor::QColor(const QString& aname) { setNamedColor(aname); } +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) inline QColor::QColor(const QColor &acolor) : cspec(acolor.cspec) { ct.argb = acolor.ct.argb; } +#endif inline bool QColor::isValid() const { return cspec != Invalid; } |