diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index a504e35c37..b3fa1eedde 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -2695,18 +2695,13 @@ QColor QColor::fromCmykF(qreal c, qreal m, qreal y, qreal k, qreal a) recommend using the darker() function for this purpose. If the \a factor is 0 or negative, the return value is unspecified. - The function converts the current RGB color to HSV, multiplies the value - (V) component by \a factor and converts the color back to RGB. + The function converts the current color to HSV, multiplies the value + (V) component by \a factor and converts the color back to it's original + color spec. \sa darker(), isValid() */ - -/*! - \obsolete - - Use lighter(\a factor) instead. -*/ -QColor QColor::light(int factor) const Q_DECL_NOTHROW +QColor QColor::lighter(int factor) const Q_DECL_NOTHROW { if (factor <= 0) // invalid lightness factor return *this; @@ -2745,18 +2740,13 @@ QColor QColor::light(int factor) const Q_DECL_NOTHROW but we recommend using the lighter() function for this purpose. If the \a factor is 0 or negative, the return value is unspecified. - The function converts the current RGB color to HSV, divides the value (V) - component by \a factor and converts the color back to RGB. + The function converts the current color to HSV, divides the value (V) + component by \a factor and converts the color back to it's original + color spec. \sa lighter(), isValid() */ - -/*! - \obsolete - - Use darker(\a factor) instead. -*/ -QColor QColor::dark(int factor) const Q_DECL_NOTHROW +QColor QColor::darker(int factor) const Q_DECL_NOTHROW { if (factor <= 0) // invalid darkness factor return *this; @@ -2770,6 +2760,28 @@ QColor QColor::dark(int factor) const Q_DECL_NOTHROW return hsv.convertTo(cspec); } +#if QT_DEPRECATED_SINCE(5, 13) +/*! + \obsolete + + Use lighter(\a factor) instead. +*/ +QColor QColor::light(int factor) const Q_DECL_NOTHROW +{ + return lighter(factor); +} + +/*! + \obsolete + + Use darker(\a factor) instead. +*/ +QColor QColor::dark(int factor) const Q_DECL_NOTHROW +{ + return darker(factor); +} +#endif + #if QT_VERSION < QT_VERSION_CHECK(6,0,0) /*! Assigns a copy of \a color to this color, and returns a reference to it. diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h index a9b05ae7e3..4822612cf8 100644 --- a/src/gui/painting/qcolor.h +++ b/src/gui/painting/qcolor.h @@ -219,9 +219,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); +#if QT_DEPRECATED_SINCE(5, 13) + QT_DEPRECATED_X("Use QColor::lighter() instead") Q_REQUIRED_RESULT QColor light(int f = 150) const Q_DECL_NOTHROW; - Q_REQUIRED_RESULT QColor lighter(int f = 150) const Q_DECL_NOTHROW; + QT_DEPRECATED_X("Use QColor::darker() instead") Q_REQUIRED_RESULT QColor dark(int f = 200) const Q_DECL_NOTHROW; +#endif + Q_REQUIRED_RESULT QColor lighter(int f = 150) const Q_DECL_NOTHROW; Q_REQUIRED_RESULT QColor darker(int f = 200) const Q_DECL_NOTHROW; bool operator==(const QColor &c) const Q_DECL_NOTHROW; @@ -308,12 +312,6 @@ inline QColor::QColor(const QColor &acolor) Q_DECL_NOTHROW inline bool QColor::isValid() const Q_DECL_NOTHROW { return cspec != Invalid; } -inline QColor QColor::lighter(int f) const Q_DECL_NOTHROW -{ return light(f); } - -inline QColor QColor::darker(int f) const Q_DECL_NOTHROW -{ return dark(f); } - QT_END_NAMESPACE #endif // QCOLOR_H