summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qcolor.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/painting/qcolor.h')
-rw-r--r--src/gui/painting/qcolor.h172
1 files changed, 89 insertions, 83 deletions
diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h
index b0192662cc..6338eedd22 100644
--- a/src/gui/painting/qcolor.h
+++ b/src/gui/painting/qcolor.h
@@ -1,31 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -60,28 +66,28 @@ public:
enum Spec { Invalid, Rgb, Hsv, Cmyk, Hsl };
enum NameFormat { HexRgb, HexArgb };
- QColor();
- QColor(Qt::GlobalColor color);
+ QColor() Q_DECL_NOTHROW;
+ QColor(Qt::GlobalColor color) Q_DECL_NOTHROW;
QColor(int r, int g, int b, int a = 255);
- QColor(QRgb rgb);
- QColor(QRgba64 rgba64);
+ QColor(QRgb rgb) Q_DECL_NOTHROW;
+ QColor(QRgba64 rgba64) Q_DECL_NOTHROW;
QColor(const QString& name);
QColor(const char *name);
- QColor(Spec spec);
+ QColor(Spec spec) Q_DECL_NOTHROW;
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
- QColor(const QColor &color); // ### Qt 6: remove all of these, the trivial ones are fine.
+ QColor(const QColor &color) Q_DECL_NOTHROW; // ### 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 &);
+ QColor &operator=(const QColor &) Q_DECL_NOTHROW;
#endif // Qt < 6
- QColor &operator=(Qt::GlobalColor color);
+ QColor &operator=(Qt::GlobalColor color) Q_DECL_NOTHROW;
- bool isValid() const;
+ bool isValid() const Q_DECL_NOTHROW;
// ### Qt 6: merge overloads
QString name() const;
@@ -90,25 +96,25 @@ public:
static QStringList colorNames();
- inline Spec spec() const
+ inline Spec spec() const Q_DECL_NOTHROW
{ return cspec; }
- int alpha() const;
+ int alpha() const Q_DECL_NOTHROW;
void setAlpha(int alpha);
- qreal alphaF() const;
+ qreal alphaF() const Q_DECL_NOTHROW;
void setAlphaF(qreal alpha);
- int red() const;
- int green() const;
- int blue() const;
+ int red() const Q_DECL_NOTHROW;
+ int green() const Q_DECL_NOTHROW;
+ int blue() const Q_DECL_NOTHROW;
void setRed(int red);
void setGreen(int green);
void setBlue(int blue);
- qreal redF() const;
- qreal greenF() const;
- qreal blueF() const;
+ qreal redF() const Q_DECL_NOTHROW;
+ qreal greenF() const Q_DECL_NOTHROW;
+ qreal blueF() const Q_DECL_NOTHROW;
void setRedF(qreal red);
void setGreenF(qreal green);
void setBlueF(qreal blue);
@@ -119,26 +125,26 @@ public:
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 Q_DECL_NOTHROW;
+ void setRgba64(QRgba64 rgba) Q_DECL_NOTHROW;
- QRgba64 rgba64() const;
- void setRgba64(QRgba64 rgba);
+ QRgb rgba() const Q_DECL_NOTHROW;
+ void setRgba(QRgb rgba) Q_DECL_NOTHROW;
- QRgb rgb() const;
- void setRgb(QRgb rgb);
+ QRgb rgb() const Q_DECL_NOTHROW;
+ void setRgb(QRgb rgb) Q_DECL_NOTHROW;
- int hue() const; // 0 <= hue < 360
- int saturation() const;
- int hsvHue() const; // 0 <= hue < 360
- int hsvSaturation() const;
- int value() const;
+ int hue() const Q_DECL_NOTHROW; // 0 <= hue < 360
+ int saturation() const Q_DECL_NOTHROW;
+ int hsvHue() const Q_DECL_NOTHROW; // 0 <= hue < 360
+ int hsvSaturation() const Q_DECL_NOTHROW;
+ int value() const Q_DECL_NOTHROW;
- qreal hueF() const; // 0.0 <= hueF < 360.0
- qreal saturationF() const;
- qreal hsvHueF() const; // 0.0 <= hueF < 360.0
- qreal hsvSaturationF() const;
- qreal valueF() const;
+ qreal hueF() const Q_DECL_NOTHROW; // 0.0 <= hueF < 360.0
+ qreal saturationF() const Q_DECL_NOTHROW;
+ qreal hsvHueF() const Q_DECL_NOTHROW; // 0.0 <= hueF < 360.0
+ qreal hsvSaturationF() const Q_DECL_NOTHROW;
+ qreal valueF() const Q_DECL_NOTHROW;
void getHsv(int *h, int *s, int *v, int *a = Q_NULLPTR) const;
void setHsv(int h, int s, int v, int a = 255);
@@ -146,15 +152,15 @@ public:
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;
- int magenta() const;
- int yellow() const;
- int black() const;
+ int cyan() const Q_DECL_NOTHROW;
+ int magenta() const Q_DECL_NOTHROW;
+ int yellow() const Q_DECL_NOTHROW;
+ int black() const Q_DECL_NOTHROW;
- qreal cyanF() const;
- qreal magentaF() const;
- qreal yellowF() const;
- qreal blackF() const;
+ qreal cyanF() const Q_DECL_NOTHROW;
+ qreal magentaF() const Q_DECL_NOTHROW;
+ qreal yellowF() const Q_DECL_NOTHROW;
+ qreal blackF() const Q_DECL_NOTHROW;
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);
@@ -162,13 +168,13 @@ public:
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
- int hslSaturation() const;
- int lightness() const;
+ int hslHue() const Q_DECL_NOTHROW; // 0 <= hue < 360
+ int hslSaturation() const Q_DECL_NOTHROW;
+ int lightness() const Q_DECL_NOTHROW;
- qreal hslHueF() const; // 0.0 <= hueF < 360.0
- qreal hslSaturationF() const;
- qreal lightnessF() const;
+ qreal hslHueF() const Q_DECL_NOTHROW; // 0.0 <= hueF < 360.0
+ qreal hslSaturationF() const Q_DECL_NOTHROW;
+ qreal lightnessF() const Q_DECL_NOTHROW;
void getHsl(int *h, int *s, int *l, int *a = Q_NULLPTR) const;
void setHsl(int h, int s, int l, int a = 255);
@@ -176,21 +182,21 @@ public:
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;
- QColor toHsv() const;
- QColor toCmyk() const;
- QColor toHsl() const;
+ QColor toRgb() const Q_DECL_NOTHROW;
+ QColor toHsv() const Q_DECL_NOTHROW;
+ QColor toCmyk() const Q_DECL_NOTHROW;
+ QColor toHsl() const Q_DECL_NOTHROW;
- QColor convertTo(Spec colorSpec) const Q_REQUIRED_RESULT;
+ QColor convertTo(Spec colorSpec) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
- static QColor fromRgb(QRgb rgb);
- static QColor fromRgba(QRgb rgba);
+ static QColor fromRgb(QRgb rgb) Q_DECL_NOTHROW;
+ static QColor fromRgba(QRgb rgba) Q_DECL_NOTHROW;
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 fromRgba64(ushort r, ushort g, ushort b, ushort a = USHRT_MAX) Q_DECL_NOTHROW;
+ static QColor fromRgba64(QRgba64 rgba) Q_DECL_NOTHROW;
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);
@@ -201,13 +207,13 @@ public:
static QColor fromHsl(int h, int s, int l, int a = 255);
static QColor fromHslF(qreal h, qreal s, qreal l, qreal a = 1.0);
- QColor light(int f = 150) const Q_REQUIRED_RESULT;
- QColor lighter(int f = 150) const Q_REQUIRED_RESULT;
- QColor dark(int f = 200) const Q_REQUIRED_RESULT;
- QColor darker(int f = 200) const Q_REQUIRED_RESULT;
+ QColor light(int f = 150) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ QColor lighter(int f = 150) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ QColor dark(int f = 200) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ QColor darker(int f = 200) const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
- bool operator==(const QColor &c) const;
- bool operator!=(const QColor &c) const;
+ bool operator==(const QColor &c) const Q_DECL_NOTHROW;
+ bool operator!=(const QColor &c) const Q_DECL_NOTHROW;
operator QVariant() const;
@@ -215,7 +221,7 @@ public:
private:
- void invalidate();
+ void invalidate() Q_DECL_NOTHROW;
bool setColorFromString(const QString &name);
Spec cspec;
@@ -258,7 +264,7 @@ private:
#endif
};
-inline QColor::QColor()
+inline QColor::QColor() Q_DECL_NOTHROW
{ invalidate(); }
inline QColor::QColor(int r, int g, int b, int a)
@@ -271,18 +277,18 @@ inline QColor::QColor(const QString& aname)
{ setNamedColor(aname); }
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
-inline QColor::QColor(const QColor &acolor)
+inline QColor::QColor(const QColor &acolor) Q_DECL_NOTHROW
: cspec(acolor.cspec)
{ ct.argb = acolor.ct.argb; }
#endif
-inline bool QColor::isValid() const
+inline bool QColor::isValid() const Q_DECL_NOTHROW
{ return cspec != Invalid; }
-inline QColor QColor::lighter(int f) const
+inline QColor QColor::lighter(int f) const Q_DECL_NOTHROW
{ return light(f); }
-inline QColor QColor::darker(int f) const
+inline QColor QColor::darker(int f) const Q_DECL_NOTHROW
{ return dark(f); }
QT_END_NAMESPACE