QColor: plaster API with Q_DECL_NOTHROW

This is mostly straight-forward, but some things are worth noting:

1. Yes, this is necessary. The noexcept operator looks for noexcept tagging,
   not at the contents of the function to determine whether to return true.
   The more conditionally-noexcept functions are used, the more important it
   becomes that low-level classes are correctly marked noexcept. In that, it
   is like constexpr.
2. In accordance with the rules governing noexcept specifications for the
   standard library itself, the get*() functions, as well as any function
   taking (but not returning) channel values as ints or qreals, or taking
   QStrings are not marked as noexcept, since they have preconditions and
   thus a narrow contract. Narrow-contract functions should not be noexcept.
   All other functions have wide contracts (ie. no preconditions).
3. Any function returning QString can throw (bad_alloc).
   Consequently, they, too, are not marked nothrow.

Change-Id: I023356ba1b9a4b057e613cd45380a89b222dc09d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Marc Mutz 2014-12-26 21:43:40 +01:00
parent e65ffae850
commit f2d1f3f1c7
2 changed files with 127 additions and 127 deletions

View File

@ -337,7 +337,7 @@ QT_BEGIN_NAMESPACE
\sa isValid(), {QColor#Predefined Colors}{Predefined Colors}
*/
QColor::QColor(Qt::GlobalColor color)
QColor::QColor(Qt::GlobalColor color) Q_DECL_NOTHROW
{
#define QRGB(r, g, b) \
QRgb(((0xffu << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff)))
@ -412,7 +412,7 @@ QColor::QColor(Qt::GlobalColor color)
\sa fromRgb(), isValid()
*/
QColor::QColor(QRgb color)
QColor::QColor(QRgb color) Q_DECL_NOTHROW
{
cspec = Rgb;
ct.argb.alpha = 0xffff;
@ -430,7 +430,7 @@ QColor::QColor(QRgb color)
\sa fromRgba64()
*/
QColor::QColor(QRgba64 rgba64)
QColor::QColor(QRgba64 rgba64) Q_DECL_NOTHROW
{
setRgba64(rgba64);
}
@ -444,7 +444,7 @@ QColor::QColor(QRgba64 rgba64)
becomes a valid color by accident.
*/
QColor::QColor(Spec spec)
QColor::QColor(Spec spec) Q_DECL_NOTHROW
{
switch (spec) {
case Invalid:
@ -964,7 +964,7 @@ void QColor::setRgb(int r, int g, int b, int a)
\sa setRgba(), rgb(), rgba64()
*/
QRgb QColor::rgba() const
QRgb QColor::rgba() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Rgb)
return toRgb().rgba();
@ -976,7 +976,7 @@ QRgb QColor::rgba() const
\sa rgba(), rgb(), setRgba64()
*/
void QColor::setRgba(QRgb rgba)
void QColor::setRgba(QRgb rgba) Q_DECL_NOTHROW
{
cspec = Rgb;
ct.argb.alpha = qAlpha(rgba) * 0x101;
@ -996,7 +996,7 @@ void QColor::setRgba(QRgb rgba)
\sa setRgba64(), rgba(), rgb()
*/
QRgba64 QColor::rgba64() const
QRgba64 QColor::rgba64() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Rgb)
return toRgb().rgba64();
@ -1010,7 +1010,7 @@ QRgba64 QColor::rgba64() const
\sa \setRgba(), rgba64()
*/
void QColor::setRgba64(QRgba64 rgba)
void QColor::setRgba64(QRgba64 rgba) Q_DECL_NOTHROW
{
cspec = Rgb;
ct.argb.alpha = rgba.alpha();
@ -1027,7 +1027,7 @@ void QColor::setRgba64(QRgba64 rgba)
\sa getRgb(), rgba()
*/
QRgb QColor::rgb() const
QRgb QColor::rgb() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Rgb)
return toRgb().rgb();
@ -1039,7 +1039,7 @@ QRgb QColor::rgb() const
Sets the RGB value to \a rgb. The alpha value is set to opaque.
*/
void QColor::setRgb(QRgb rgb)
void QColor::setRgb(QRgb rgb) Q_DECL_NOTHROW
{
cspec = Rgb;
ct.argb.alpha = 0xffff;
@ -1054,7 +1054,7 @@ void QColor::setRgb(QRgb rgb)
\sa setAlpha(), alphaF(), {QColor#Alpha-Blended Drawing}{Alpha-Blended Drawing}
*/
int QColor::alpha() const
int QColor::alpha() const Q_DECL_NOTHROW
{ return ct.argb.alpha >> 8; }
@ -1076,7 +1076,7 @@ void QColor::setAlpha(int alpha)
\sa setAlphaF(), alpha(), {QColor#Alpha-Blended Drawing}{Alpha-Blended Drawing}
*/
qreal QColor::alphaF() const
qreal QColor::alphaF() const Q_DECL_NOTHROW
{ return ct.argb.alpha / qreal(USHRT_MAX); }
/*!
@ -1099,7 +1099,7 @@ void QColor::setAlphaF(qreal alpha)
\sa setRed(), redF(), getRgb()
*/
int QColor::red() const
int QColor::red() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Rgb)
return toRgb().red();
@ -1126,7 +1126,7 @@ void QColor::setRed(int red)
\sa setGreen(), greenF(), getRgb()
*/
int QColor::green() const
int QColor::green() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Rgb)
return toRgb().green();
@ -1154,7 +1154,7 @@ void QColor::setGreen(int green)
\sa setBlue(), blueF(), getRgb()
*/
int QColor::blue() const
int QColor::blue() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Rgb)
return toRgb().blue();
@ -1182,7 +1182,7 @@ void QColor::setBlue(int blue)
\sa setRedF(), red(), getRgbF()
*/
qreal QColor::redF() const
qreal QColor::redF() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Rgb)
return toRgb().redF();
@ -1210,7 +1210,7 @@ void QColor::setRedF(qreal red)
\sa setGreenF(), green(), getRgbF()
*/
qreal QColor::greenF() const
qreal QColor::greenF() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Rgb)
return toRgb().greenF();
@ -1238,7 +1238,7 @@ void QColor::setGreenF(qreal green)
\sa setBlueF(), blue(), getRgbF()
*/
qreal QColor::blueF() const
qreal QColor::blueF() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Rgb)
return toRgb().blueF();
@ -1268,7 +1268,7 @@ void QColor::setBlueF(qreal blue)
\sa hsvHue(), hueF(), getHsv(), {QColor#The HSV Color Model}{The HSV Color Model}
*/
int QColor::hue() const
int QColor::hue() const Q_DECL_NOTHROW
{
return hsvHue();
}
@ -1278,7 +1278,7 @@ int QColor::hue() const
\sa hueF(), getHsv(), {QColor#The HSV Color Model}{The HSV Color Model}
*/
int QColor::hsvHue() const
int QColor::hsvHue() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Hsv)
return toHsv().hue();
@ -1294,7 +1294,7 @@ int QColor::hsvHue() const
Model}
*/
int QColor::saturation() const
int QColor::saturation() const Q_DECL_NOTHROW
{
return hsvSaturation();
}
@ -1304,7 +1304,7 @@ int QColor::saturation() const
\sa saturationF(), getHsv(), {QColor#The HSV Color Model}{The HSV Color Model}
*/
int QColor::hsvSaturation() const
int QColor::hsvSaturation() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Hsv)
return toHsv().saturation();
@ -1316,7 +1316,7 @@ int QColor::hsvSaturation() const
\sa valueF(), getHsv(), {QColor#The HSV Color Model}{The HSV Color Model}
*/
int QColor::value() const
int QColor::value() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Hsv)
return toHsv().value();
@ -1330,7 +1330,7 @@ int QColor::value() const
\sa hsvHueF(), hue(), getHsvF(), {QColor#The HSV Color Model}{The HSV Color Model}
*/
qreal QColor::hueF() const
qreal QColor::hueF() const Q_DECL_NOTHROW
{
return hsvHueF();
}
@ -1341,7 +1341,7 @@ qreal QColor::hueF() const
\sa hue(), getHsvF(), {QColor#The HSV Color Model}{The HSV Color
Model}
*/
qreal QColor::hsvHueF() const
qreal QColor::hsvHueF() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Hsv)
return toHsv().hueF();
@ -1356,7 +1356,7 @@ qreal QColor::hsvHueF() const
\sa hsvSaturationF(), saturation(), getHsvF(), {QColor#The HSV Color Model}{The HSV Color
Model}
*/
qreal QColor::saturationF() const
qreal QColor::saturationF() const Q_DECL_NOTHROW
{
return hsvSaturationF();
}
@ -1366,7 +1366,7 @@ qreal QColor::saturationF() const
\sa saturation(), getHsvF(), {QColor#The HSV Color Model}{The HSV Color Model}
*/
qreal QColor::hsvSaturationF() const
qreal QColor::hsvSaturationF() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Hsv)
return toHsv().saturationF();
@ -1378,7 +1378,7 @@ qreal QColor::hsvSaturationF() const
\sa value(), getHsvF(), {QColor#The HSV Color Model}{The HSV Color Model}
*/
qreal QColor::valueF() const
qreal QColor::valueF() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Hsv)
return toHsv().valueF();
@ -1392,7 +1392,7 @@ qreal QColor::valueF() const
\sa getHslF(), getHsl()
*/
int QColor::hslHue() const
int QColor::hslHue() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Hsl)
return toHsl().hslHue();
@ -1406,7 +1406,7 @@ int QColor::hslHue() const
\sa saturationF(), getHsv(), {QColor#The HSV Color Model}{The HSV Color Model}
*/
int QColor::hslSaturation() const
int QColor::hslSaturation() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Hsl)
return toHsl().hslSaturation();
@ -1420,7 +1420,7 @@ int QColor::hslSaturation() const
\sa lightnessF(), getHsl()
*/
int QColor::lightness() const
int QColor::lightness() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Hsl)
return toHsl().lightness();
@ -1434,7 +1434,7 @@ int QColor::lightness() const
\sa hue(), getHslF()
*/
qreal QColor::hslHueF() const
qreal QColor::hslHueF() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Hsl)
return toHsl().hslHueF();
@ -1448,7 +1448,7 @@ qreal QColor::hslHueF() const
\sa saturationF(), getHslF()
*/
qreal QColor::hslSaturationF() const
qreal QColor::hslSaturationF() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Hsl)
return toHsl().hslSaturationF();
@ -1462,7 +1462,7 @@ qreal QColor::hslSaturationF() const
\sa value(), getHslF()
*/
qreal QColor::lightnessF() const
qreal QColor::lightnessF() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Hsl)
return toHsl().lightnessF();
@ -1474,7 +1474,7 @@ qreal QColor::lightnessF() const
\sa cyanF(), getCmyk(), {QColor#The CMYK Color Model}{The CMYK Color Model}
*/
int QColor::cyan() const
int QColor::cyan() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Cmyk)
return toCmyk().cyan();
@ -1486,7 +1486,7 @@ int QColor::cyan() const
\sa magentaF(), getCmyk(), {QColor#The CMYK Color Model}{The CMYK Color Model}
*/
int QColor::magenta() const
int QColor::magenta() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Cmyk)
return toCmyk().magenta();
@ -1498,7 +1498,7 @@ int QColor::magenta() const
\sa yellowF(), getCmyk(), {QColor#The CMYK Color Model}{The CMYK Color Model}
*/
int QColor::yellow() const
int QColor::yellow() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Cmyk)
return toCmyk().yellow();
@ -1511,7 +1511,7 @@ int QColor::yellow() const
\sa blackF(), getCmyk(), {QColor#The CMYK Color Model}{The CMYK Color Model}
*/
int QColor::black() const
int QColor::black() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Cmyk)
return toCmyk().black();
@ -1523,7 +1523,7 @@ int QColor::black() const
\sa cyan(), getCmykF(), {QColor#The CMYK Color Model}{The CMYK Color Model}
*/
qreal QColor::cyanF() const
qreal QColor::cyanF() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Cmyk)
return toCmyk().cyanF();
@ -1535,7 +1535,7 @@ qreal QColor::cyanF() const
\sa magenta(), getCmykF(), {QColor#The CMYK Color Model}{The CMYK Color Model}
*/
qreal QColor::magentaF() const
qreal QColor::magentaF() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Cmyk)
return toCmyk().magentaF();
@ -1547,7 +1547,7 @@ qreal QColor::magentaF() const
\sa yellow(), getCmykF(), {QColor#The CMYK Color Model}{The CMYK Color Model}
*/
qreal QColor::yellowF() const
qreal QColor::yellowF() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Cmyk)
return toCmyk().yellowF();
@ -1559,7 +1559,7 @@ qreal QColor::yellowF() const
\sa black(), getCmykF(), {QColor#The CMYK Color Model}{The CMYK Color Model}
*/
qreal QColor::blackF() const
qreal QColor::blackF() const Q_DECL_NOTHROW
{
if (cspec != Invalid && cspec != Cmyk)
return toCmyk().blackF();
@ -1571,7 +1571,7 @@ qreal QColor::blackF() const
\sa fromRgb(), convertTo(), isValid()
*/
QColor QColor::toRgb() const
QColor QColor::toRgb() const Q_DECL_NOTHROW
{
if (!isValid() || cspec == Rgb)
return *this;
@ -1717,7 +1717,7 @@ QColor QColor::toRgb() const
\sa fromHsv(), convertTo(), isValid(), {QColor#The HSV Color Model}{The HSV Color Model}
*/
QColor QColor::toHsv() const
QColor QColor::toHsv() const Q_DECL_NOTHROW
{
if (!isValid() || cspec == Hsv)
return *this;
@ -1768,7 +1768,7 @@ QColor QColor::toHsv() const
\sa fromHsl(), convertTo(), isValid()
*/
QColor QColor::toHsl() const
QColor QColor::toHsl() const Q_DECL_NOTHROW
{
if (!isValid() || cspec == Hsl)
return *this;
@ -1824,7 +1824,7 @@ QColor QColor::toHsl() const
\sa fromCmyk(), convertTo(), isValid(), {QColor#The CMYK Color Model}{The CMYK Color Model}
*/
QColor QColor::toCmyk() const
QColor QColor::toCmyk() const Q_DECL_NOTHROW
{
if (!isValid() || cspec == Cmyk)
return *this;
@ -1860,7 +1860,7 @@ QColor QColor::toCmyk() const
return color;
}
QColor QColor::convertTo(QColor::Spec colorSpec) const
QColor QColor::convertTo(QColor::Spec colorSpec) const Q_DECL_NOTHROW
{
if (colorSpec == cspec)
return *this;
@ -1891,7 +1891,7 @@ QColor QColor::convertTo(QColor::Spec colorSpec) const
\sa fromRgba(), fromRgbF(), toRgb(), isValid()
*/
QColor QColor::fromRgb(QRgb rgb)
QColor QColor::fromRgb(QRgb rgb) Q_DECL_NOTHROW
{
return fromRgb(qRed(rgb), qGreen(rgb), qBlue(rgb));
}
@ -1907,7 +1907,7 @@ QColor QColor::fromRgb(QRgb rgb)
\sa fromRgb(), fromRgba64(), isValid()
*/
QColor QColor::fromRgba(QRgb rgba)
QColor QColor::fromRgba(QRgb rgba) Q_DECL_NOTHROW
{
return fromRgb(qRed(rgba), qGreen(rgba), qBlue(rgba), qAlpha(rgba));
}
@ -1980,7 +1980,7 @@ QColor QColor::fromRgbF(qreal r, qreal g, qreal b, qreal a)
\sa fromRgb(), fromRgbF(), toRgb(), isValid()
*/
QColor QColor::fromRgba64(ushort r, ushort g, ushort b, ushort a)
QColor QColor::fromRgba64(ushort r, ushort g, ushort b, ushort a) Q_DECL_NOTHROW
{
QColor color;
color.setRgba64(qRgba64(r, g, b, a));
@ -1995,7 +1995,7 @@ QColor QColor::fromRgba64(ushort r, ushort g, ushort b, ushort a)
\sa fromRgb(), fromRgbF(), toRgb(), isValid()
*/
QColor QColor::fromRgba64(QRgba64 rgba64)
QColor QColor::fromRgba64(QRgba64 rgba64) Q_DECL_NOTHROW
{
QColor color;
color.setRgba64(rgba64);
@ -2329,7 +2329,7 @@ QColor QColor::fromCmykF(qreal c, qreal m, qreal y, qreal k, qreal a)
Use lighter(\a factor) instead.
*/
QColor QColor::light(int factor) const
QColor QColor::light(int factor) const Q_DECL_NOTHROW
{
if (factor <= 0) // invalid lightness factor
return *this;
@ -2379,7 +2379,7 @@ QColor QColor::light(int factor) const
Use darker(\a factor) instead.
*/
QColor QColor::dark(int factor) const
QColor QColor::dark(int factor) const Q_DECL_NOTHROW
{
if (factor <= 0) // invalid darkness factor
return *this;
@ -2397,7 +2397,7 @@ QColor QColor::dark(int factor) const
/*!
Assigns a copy of \a color to this color, and returns a reference to it.
*/
QColor &QColor::operator=(const QColor &color)
QColor &QColor::operator=(const QColor &color) Q_DECL_NOTHROW
{
cspec = color.cspec;
ct.argb = color.ct.argb;
@ -2408,7 +2408,7 @@ QColor &QColor::operator=(const QColor &color)
/*! \overload
Assigns a copy of \a color and returns a reference to this color.
*/
QColor &QColor::operator=(Qt::GlobalColor color)
QColor &QColor::operator=(Qt::GlobalColor color) Q_DECL_NOTHROW
{
return operator=(QColor(color));
}
@ -2417,7 +2417,7 @@ QColor &QColor::operator=(Qt::GlobalColor color)
Returns \c true if this color has the same RGB and alpha values as \a color;
otherwise returns \c false.
*/
bool QColor::operator==(const QColor &color) const
bool QColor::operator==(const QColor &color) const Q_DECL_NOTHROW
{
if (cspec == Hsl && cspec == color.cspec) {
return (ct.argb.alpha == color.ct.argb.alpha
@ -2444,7 +2444,7 @@ bool QColor::operator==(const QColor &color) const
Returns \c true if this color has a different RGB and alpha values from
\a color; otherwise returns \c false.
*/
bool QColor::operator!=(const QColor &color) const
bool QColor::operator!=(const QColor &color) const Q_DECL_NOTHROW
{ return !operator==(color); }
@ -2461,7 +2461,7 @@ QColor::operator QVariant() const
Marks the color as invalid and sets all components to zero (alpha is set
to fully opaque for compatibility with Qt 3).
*/
void QColor::invalidate()
void QColor::invalidate() Q_DECL_NOTHROW
{
cspec = Invalid;
ct.argb.alpha = USHRT_MAX;

View File

@ -66,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;
@ -96,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);
@ -125,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);
@ -152,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);
@ -168,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);
@ -182,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);
@ -207,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;
@ -221,7 +221,7 @@ public:
private:
void invalidate();
void invalidate() Q_DECL_NOTHROW;
bool setColorFromString(const QString &name);
Spec cspec;
@ -264,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)
@ -277,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