diff options
Diffstat (limited to 'src/gui/painting/qcolor.cpp')
-rw-r--r-- | src/gui/painting/qcolor.cpp | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 07202f5b1c..bb42660cf2 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -653,7 +653,7 @@ static QStringList get_colornames() \sa isValid(), {QColor#Predefined Colors}{Predefined Colors} */ -QColor::QColor(Qt::GlobalColor color) Q_DECL_NOTHROW +QColor::QColor(Qt::GlobalColor color) noexcept { #define QRGB(r, g, b) \ QRgb(((0xffu << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff))) @@ -728,7 +728,7 @@ QColor::QColor(Qt::GlobalColor color) Q_DECL_NOTHROW \sa fromRgb(), isValid() */ -QColor::QColor(QRgb color) Q_DECL_NOTHROW +QColor::QColor(QRgb color) noexcept { cspec = Rgb; ct.argb.alpha = 0xffff; @@ -746,7 +746,7 @@ QColor::QColor(QRgb color) Q_DECL_NOTHROW \sa fromRgba64() */ -QColor::QColor(QRgba64 rgba64) Q_DECL_NOTHROW +QColor::QColor(QRgba64 rgba64) noexcept { setRgba64(rgba64); } @@ -760,7 +760,7 @@ QColor::QColor(QRgba64 rgba64) Q_DECL_NOTHROW becomes a valid color by accident. */ -QColor::QColor(Spec spec) Q_DECL_NOTHROW +QColor::QColor(Spec spec) noexcept { switch (spec) { case Invalid: @@ -933,7 +933,7 @@ bool QColor::isValidColor(const QString &name) \overload \since 5.10 */ -bool QColor::isValidColor(QStringView name) Q_DECL_NOTHROW +bool QColor::isValidColor(QStringView name) noexcept { return name.size() && QColor().setColorFromString(name); } @@ -942,7 +942,7 @@ bool QColor::isValidColor(QStringView name) Q_DECL_NOTHROW \overload \since 5.8 */ -bool QColor::isValidColor(QLatin1String name) Q_DECL_NOTHROW +bool QColor::isValidColor(QLatin1String name) noexcept { return name.size() && QColor().setColorFromString(name); } @@ -1330,7 +1330,7 @@ void QColor::setRgb(int r, int g, int b, int a) \sa setRgba(), rgb(), rgba64() */ -QRgb QColor::rgba() const Q_DECL_NOTHROW +QRgb QColor::rgba() const noexcept { if (cspec != Invalid && cspec != Rgb) return toRgb().rgba(); @@ -1342,7 +1342,7 @@ QRgb QColor::rgba() const Q_DECL_NOTHROW \sa rgba(), rgb(), setRgba64() */ -void QColor::setRgba(QRgb rgba) Q_DECL_NOTHROW +void QColor::setRgba(QRgb rgba) noexcept { cspec = Rgb; ct.argb.alpha = qAlpha(rgba) * 0x101; @@ -1362,7 +1362,7 @@ void QColor::setRgba(QRgb rgba) Q_DECL_NOTHROW \sa setRgba64(), rgba(), rgb() */ -QRgba64 QColor::rgba64() const Q_DECL_NOTHROW +QRgba64 QColor::rgba64() const noexcept { if (cspec != Invalid && cspec != Rgb) return toRgb().rgba64(); @@ -1376,7 +1376,7 @@ QRgba64 QColor::rgba64() const Q_DECL_NOTHROW \sa setRgba(), rgba64() */ -void QColor::setRgba64(QRgba64 rgba) Q_DECL_NOTHROW +void QColor::setRgba64(QRgba64 rgba) noexcept { cspec = Rgb; ct.argb.alpha = rgba.alpha(); @@ -1393,7 +1393,7 @@ void QColor::setRgba64(QRgba64 rgba) Q_DECL_NOTHROW \sa getRgb(), rgba() */ -QRgb QColor::rgb() const Q_DECL_NOTHROW +QRgb QColor::rgb() const noexcept { if (cspec != Invalid && cspec != Rgb) return toRgb().rgb(); @@ -1405,7 +1405,7 @@ QRgb QColor::rgb() const Q_DECL_NOTHROW Sets the RGB value to \a rgb. The alpha value is set to opaque. */ -void QColor::setRgb(QRgb rgb) Q_DECL_NOTHROW +void QColor::setRgb(QRgb rgb) noexcept { cspec = Rgb; ct.argb.alpha = 0xffff; @@ -1420,7 +1420,7 @@ void QColor::setRgb(QRgb rgb) Q_DECL_NOTHROW \sa setAlpha(), alphaF(), {QColor#Alpha-Blended Drawing}{Alpha-Blended Drawing} */ -int QColor::alpha() const Q_DECL_NOTHROW +int QColor::alpha() const noexcept { return ct.argb.alpha >> 8; } @@ -1442,7 +1442,7 @@ void QColor::setAlpha(int alpha) \sa setAlphaF(), alpha(), {QColor#Alpha-Blended Drawing}{Alpha-Blended Drawing} */ -qreal QColor::alphaF() const Q_DECL_NOTHROW +qreal QColor::alphaF() const noexcept { return ct.argb.alpha / qreal(USHRT_MAX); } /*! @@ -1465,7 +1465,7 @@ void QColor::setAlphaF(qreal alpha) \sa setRed(), redF(), getRgb() */ -int QColor::red() const Q_DECL_NOTHROW +int QColor::red() const noexcept { if (cspec != Invalid && cspec != Rgb) return toRgb().red(); @@ -1492,7 +1492,7 @@ void QColor::setRed(int red) \sa setGreen(), greenF(), getRgb() */ -int QColor::green() const Q_DECL_NOTHROW +int QColor::green() const noexcept { if (cspec != Invalid && cspec != Rgb) return toRgb().green(); @@ -1520,7 +1520,7 @@ void QColor::setGreen(int green) \sa setBlue(), blueF(), getRgb() */ -int QColor::blue() const Q_DECL_NOTHROW +int QColor::blue() const noexcept { if (cspec != Invalid && cspec != Rgb) return toRgb().blue(); @@ -1548,7 +1548,7 @@ void QColor::setBlue(int blue) \sa setRedF(), red(), getRgbF() */ -qreal QColor::redF() const Q_DECL_NOTHROW +qreal QColor::redF() const noexcept { if (cspec != Invalid && cspec != Rgb) return toRgb().redF(); @@ -1576,7 +1576,7 @@ void QColor::setRedF(qreal red) \sa setGreenF(), green(), getRgbF() */ -qreal QColor::greenF() const Q_DECL_NOTHROW +qreal QColor::greenF() const noexcept { if (cspec != Invalid && cspec != Rgb) return toRgb().greenF(); @@ -1604,7 +1604,7 @@ void QColor::setGreenF(qreal green) \sa setBlueF(), blue(), getRgbF() */ -qreal QColor::blueF() const Q_DECL_NOTHROW +qreal QColor::blueF() const noexcept { if (cspec != Invalid && cspec != Rgb) return toRgb().blueF(); @@ -1634,7 +1634,7 @@ void QColor::setBlueF(qreal blue) \sa hsvHue(), hslHue(), hueF(), getHsv(), {QColor#The HSV Color Model}{The HSV Color Model} */ -int QColor::hue() const Q_DECL_NOTHROW +int QColor::hue() const noexcept { return hsvHue(); } @@ -1644,7 +1644,7 @@ int QColor::hue() const Q_DECL_NOTHROW \sa hueF(), hslHue(), getHsv(), {QColor#The HSV Color Model}{The HSV Color Model} */ -int QColor::hsvHue() const Q_DECL_NOTHROW +int QColor::hsvHue() const noexcept { if (cspec != Invalid && cspec != Hsv) return toHsv().hue(); @@ -1660,7 +1660,7 @@ int QColor::hsvHue() const Q_DECL_NOTHROW Model} */ -int QColor::saturation() const Q_DECL_NOTHROW +int QColor::saturation() const noexcept { return hsvSaturation(); } @@ -1670,7 +1670,7 @@ int QColor::saturation() const Q_DECL_NOTHROW \sa saturationF(), hslSaturation(), getHsv(), {QColor#The HSV Color Model}{The HSV Color Model} */ -int QColor::hsvSaturation() const Q_DECL_NOTHROW +int QColor::hsvSaturation() const noexcept { if (cspec != Invalid && cspec != Hsv) return toHsv().saturation(); @@ -1682,7 +1682,7 @@ int QColor::hsvSaturation() const Q_DECL_NOTHROW \sa valueF(), getHsv(), {QColor#The HSV Color Model}{The HSV Color Model} */ -int QColor::value() const Q_DECL_NOTHROW +int QColor::value() const noexcept { if (cspec != Invalid && cspec != Hsv) return toHsv().value(); @@ -1696,7 +1696,7 @@ int QColor::value() const Q_DECL_NOTHROW \sa hsvHueF(), hslHueF(), hue(), getHsvF(), {QColor#The HSV Color Model}{The HSV Color Model} */ -qreal QColor::hueF() const Q_DECL_NOTHROW +qreal QColor::hueF() const noexcept { return hsvHueF(); } @@ -1707,7 +1707,7 @@ qreal QColor::hueF() const Q_DECL_NOTHROW \sa hue(), hslHueF(), getHsvF(), {QColor#The HSV Color Model}{The HSV Color Model} */ -qreal QColor::hsvHueF() const Q_DECL_NOTHROW +qreal QColor::hsvHueF() const noexcept { if (cspec != Invalid && cspec != Hsv) return toHsv().hueF(); @@ -1722,7 +1722,7 @@ qreal QColor::hsvHueF() const Q_DECL_NOTHROW \sa hsvSaturationF(), hslSaturationF(), saturation(), getHsvF(), {QColor#The HSV Color Model}{The HSV Color Model} */ -qreal QColor::saturationF() const Q_DECL_NOTHROW +qreal QColor::saturationF() const noexcept { return hsvSaturationF(); } @@ -1732,7 +1732,7 @@ qreal QColor::saturationF() const Q_DECL_NOTHROW \sa saturation(), hslSaturationF(), getHsvF(), {QColor#The HSV Color Model}{The HSV Color Model} */ -qreal QColor::hsvSaturationF() const Q_DECL_NOTHROW +qreal QColor::hsvSaturationF() const noexcept { if (cspec != Invalid && cspec != Hsv) return toHsv().saturationF(); @@ -1744,7 +1744,7 @@ qreal QColor::hsvSaturationF() const Q_DECL_NOTHROW \sa value(), getHsvF(), {QColor#The HSV Color Model}{The HSV Color Model} */ -qreal QColor::valueF() const Q_DECL_NOTHROW +qreal QColor::valueF() const noexcept { if (cspec != Invalid && cspec != Hsv) return toHsv().valueF(); @@ -1758,7 +1758,7 @@ qreal QColor::valueF() const Q_DECL_NOTHROW \sa hslHueF(), hsvHue(), getHsl(), {QColor#The HSL Color Model}{The HSL Color Model} */ -int QColor::hslHue() const Q_DECL_NOTHROW +int QColor::hslHue() const noexcept { if (cspec != Invalid && cspec != Hsl) return toHsl().hslHue(); @@ -1772,7 +1772,7 @@ int QColor::hslHue() const Q_DECL_NOTHROW \sa hslSaturationF(), hsvSaturation(), getHsl(), {QColor#The HSL Color Model}{The HSL Color Model} */ -int QColor::hslSaturation() const Q_DECL_NOTHROW +int QColor::hslSaturation() const noexcept { if (cspec != Invalid && cspec != Hsl) return toHsl().hslSaturation(); @@ -1786,7 +1786,7 @@ int QColor::hslSaturation() const Q_DECL_NOTHROW \sa lightnessF(), getHsl() */ -int QColor::lightness() const Q_DECL_NOTHROW +int QColor::lightness() const noexcept { if (cspec != Invalid && cspec != Hsl) return toHsl().lightness(); @@ -1800,7 +1800,7 @@ int QColor::lightness() const Q_DECL_NOTHROW \sa hslHue(), hsvHueF(), getHslF() */ -qreal QColor::hslHueF() const Q_DECL_NOTHROW +qreal QColor::hslHueF() const noexcept { if (cspec != Invalid && cspec != Hsl) return toHsl().hslHueF(); @@ -1814,7 +1814,7 @@ qreal QColor::hslHueF() const Q_DECL_NOTHROW \sa hslSaturation(), hsvSaturationF(), getHslF(), {QColor#The HSL Color Model}{The HSL Color Model} */ -qreal QColor::hslSaturationF() const Q_DECL_NOTHROW +qreal QColor::hslSaturationF() const noexcept { if (cspec != Invalid && cspec != Hsl) return toHsl().hslSaturationF(); @@ -1828,7 +1828,7 @@ qreal QColor::hslSaturationF() const Q_DECL_NOTHROW \sa value(), getHslF() */ -qreal QColor::lightnessF() const Q_DECL_NOTHROW +qreal QColor::lightnessF() const noexcept { if (cspec != Invalid && cspec != Hsl) return toHsl().lightnessF(); @@ -1840,7 +1840,7 @@ qreal QColor::lightnessF() const Q_DECL_NOTHROW \sa cyanF(), getCmyk(), {QColor#The CMYK Color Model}{The CMYK Color Model} */ -int QColor::cyan() const Q_DECL_NOTHROW +int QColor::cyan() const noexcept { if (cspec != Invalid && cspec != Cmyk) return toCmyk().cyan(); @@ -1852,7 +1852,7 @@ int QColor::cyan() const Q_DECL_NOTHROW \sa magentaF(), getCmyk(), {QColor#The CMYK Color Model}{The CMYK Color Model} */ -int QColor::magenta() const Q_DECL_NOTHROW +int QColor::magenta() const noexcept { if (cspec != Invalid && cspec != Cmyk) return toCmyk().magenta(); @@ -1864,7 +1864,7 @@ int QColor::magenta() const Q_DECL_NOTHROW \sa yellowF(), getCmyk(), {QColor#The CMYK Color Model}{The CMYK Color Model} */ -int QColor::yellow() const Q_DECL_NOTHROW +int QColor::yellow() const noexcept { if (cspec != Invalid && cspec != Cmyk) return toCmyk().yellow(); @@ -1877,7 +1877,7 @@ int QColor::yellow() const Q_DECL_NOTHROW \sa blackF(), getCmyk(), {QColor#The CMYK Color Model}{The CMYK Color Model} */ -int QColor::black() const Q_DECL_NOTHROW +int QColor::black() const noexcept { if (cspec != Invalid && cspec != Cmyk) return toCmyk().black(); @@ -1889,7 +1889,7 @@ int QColor::black() const Q_DECL_NOTHROW \sa cyan(), getCmykF(), {QColor#The CMYK Color Model}{The CMYK Color Model} */ -qreal QColor::cyanF() const Q_DECL_NOTHROW +qreal QColor::cyanF() const noexcept { if (cspec != Invalid && cspec != Cmyk) return toCmyk().cyanF(); @@ -1901,7 +1901,7 @@ qreal QColor::cyanF() const Q_DECL_NOTHROW \sa magenta(), getCmykF(), {QColor#The CMYK Color Model}{The CMYK Color Model} */ -qreal QColor::magentaF() const Q_DECL_NOTHROW +qreal QColor::magentaF() const noexcept { if (cspec != Invalid && cspec != Cmyk) return toCmyk().magentaF(); @@ -1913,7 +1913,7 @@ qreal QColor::magentaF() const Q_DECL_NOTHROW \sa yellow(), getCmykF(), {QColor#The CMYK Color Model}{The CMYK Color Model} */ -qreal QColor::yellowF() const Q_DECL_NOTHROW +qreal QColor::yellowF() const noexcept { if (cspec != Invalid && cspec != Cmyk) return toCmyk().yellowF(); @@ -1925,7 +1925,7 @@ qreal QColor::yellowF() const Q_DECL_NOTHROW \sa black(), getCmykF(), {QColor#The CMYK Color Model}{The CMYK Color Model} */ -qreal QColor::blackF() const Q_DECL_NOTHROW +qreal QColor::blackF() const noexcept { if (cspec != Invalid && cspec != Cmyk) return toCmyk().blackF(); @@ -1937,7 +1937,7 @@ qreal QColor::blackF() const Q_DECL_NOTHROW \sa fromRgb(), convertTo(), isValid() */ -QColor QColor::toRgb() const Q_DECL_NOTHROW +QColor QColor::toRgb() const noexcept { if (!isValid() || cspec == Rgb) return *this; @@ -2083,7 +2083,7 @@ QColor QColor::toRgb() const Q_DECL_NOTHROW \sa fromHsv(), convertTo(), isValid(), {QColor#The HSV Color Model}{The HSV Color Model} */ -QColor QColor::toHsv() const Q_DECL_NOTHROW +QColor QColor::toHsv() const noexcept { if (!isValid() || cspec == Hsv) return *this; @@ -2134,7 +2134,7 @@ QColor QColor::toHsv() const Q_DECL_NOTHROW \sa fromHsl(), convertTo(), isValid(), {QColor#The HSL Color Model}{The HSL Color Model} */ -QColor QColor::toHsl() const Q_DECL_NOTHROW +QColor QColor::toHsl() const noexcept { if (!isValid() || cspec == Hsl) return *this; @@ -2190,7 +2190,7 @@ QColor QColor::toHsl() const Q_DECL_NOTHROW \sa fromCmyk(), convertTo(), isValid(), {QColor#The CMYK Color Model}{The CMYK Color Model} */ -QColor QColor::toCmyk() const Q_DECL_NOTHROW +QColor QColor::toCmyk() const noexcept { if (!isValid() || cspec == Cmyk) return *this; @@ -2231,7 +2231,7 @@ QColor QColor::toCmyk() const Q_DECL_NOTHROW return color; } -QColor QColor::convertTo(QColor::Spec colorSpec) const Q_DECL_NOTHROW +QColor QColor::convertTo(QColor::Spec colorSpec) const noexcept { if (colorSpec == cspec) return *this; @@ -2262,7 +2262,7 @@ QColor QColor::convertTo(QColor::Spec colorSpec) const Q_DECL_NOTHROW \sa fromRgba(), fromRgbF(), toRgb(), isValid() */ -QColor QColor::fromRgb(QRgb rgb) Q_DECL_NOTHROW +QColor QColor::fromRgb(QRgb rgb) noexcept { return fromRgb(qRed(rgb), qGreen(rgb), qBlue(rgb)); } @@ -2278,7 +2278,7 @@ QColor QColor::fromRgb(QRgb rgb) Q_DECL_NOTHROW \sa fromRgb(), fromRgba64(), isValid() */ -QColor QColor::fromRgba(QRgb rgba) Q_DECL_NOTHROW +QColor QColor::fromRgba(QRgb rgba) noexcept { return fromRgb(qRed(rgba), qGreen(rgba), qBlue(rgba), qAlpha(rgba)); } @@ -2351,7 +2351,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) Q_DECL_NOTHROW +QColor QColor::fromRgba64(ushort r, ushort g, ushort b, ushort a) noexcept { QColor color; color.setRgba64(qRgba64(r, g, b, a)); @@ -2366,7 +2366,7 @@ QColor QColor::fromRgba64(ushort r, ushort g, ushort b, ushort a) Q_DECL_NOTHROW \sa fromRgb(), fromRgbF(), toRgb(), isValid() */ -QColor QColor::fromRgba64(QRgba64 rgba64) Q_DECL_NOTHROW +QColor QColor::fromRgba64(QRgba64 rgba64) noexcept { QColor color; color.setRgba64(rgba64); @@ -2714,7 +2714,7 @@ QColor QColor::fromCmykF(qreal c, qreal m, qreal y, qreal k, qreal a) \sa darker(), isValid() */ -QColor QColor::lighter(int factor) const Q_DECL_NOTHROW +QColor QColor::lighter(int factor) const noexcept { if (factor <= 0) // invalid lightness factor return *this; @@ -2759,7 +2759,7 @@ QColor QColor::lighter(int factor) const Q_DECL_NOTHROW \sa lighter(), isValid() */ -QColor QColor::darker(int factor) const Q_DECL_NOTHROW +QColor QColor::darker(int factor) const noexcept { if (factor <= 0) // invalid darkness factor return *this; @@ -2779,7 +2779,7 @@ QColor QColor::darker(int factor) const Q_DECL_NOTHROW Use lighter(\a factor) instead. */ -QColor QColor::light(int factor) const Q_DECL_NOTHROW +QColor QColor::light(int factor) const noexcept { return lighter(factor); } @@ -2789,7 +2789,7 @@ QColor QColor::light(int factor) const Q_DECL_NOTHROW Use darker(\a factor) instead. */ -QColor QColor::dark(int factor) const Q_DECL_NOTHROW +QColor QColor::dark(int factor) const noexcept { return darker(factor); } @@ -2799,7 +2799,7 @@ QColor QColor::dark(int factor) const Q_DECL_NOTHROW /*! Assigns a copy of \a color to this color, and returns a reference to it. */ -QColor &QColor::operator=(const QColor &color) Q_DECL_NOTHROW +QColor &QColor::operator=(const QColor &color) noexcept { cspec = color.cspec; ct.argb = color.ct.argb; @@ -2810,7 +2810,7 @@ QColor &QColor::operator=(const QColor &color) Q_DECL_NOTHROW /*! \overload Assigns a copy of \a color and returns a reference to this color. */ -QColor &QColor::operator=(Qt::GlobalColor color) Q_DECL_NOTHROW +QColor &QColor::operator=(Qt::GlobalColor color) noexcept { return operator=(QColor(color)); } @@ -2819,7 +2819,7 @@ QColor &QColor::operator=(Qt::GlobalColor color) Q_DECL_NOTHROW 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 Q_DECL_NOTHROW +bool QColor::operator==(const QColor &color) const noexcept { if (cspec == Hsl && cspec == color.cspec) { return (ct.argb.alpha == color.ct.argb.alpha @@ -2846,7 +2846,7 @@ bool QColor::operator==(const QColor &color) const Q_DECL_NOTHROW 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 Q_DECL_NOTHROW +bool QColor::operator!=(const QColor &color) const noexcept { return !operator==(color); } @@ -2863,7 +2863,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() Q_DECL_NOTHROW +void QColor::invalidate() noexcept { cspec = Invalid; ct.argb.alpha = USHRT_MAX; |