diff options
Diffstat (limited to 'src/gui/painting/qcolor.cpp')
-rw-r--r-- | src/gui/painting/qcolor.cpp | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 265e3496f3..2af2e8cb6b 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -784,12 +784,10 @@ QColor::QColor(Spec spec) noexcept } } -#if QT_DEPRECATED_SINCE(6, 6) +// ### Qt 7: remove those after deprecating them for the last Qt 6 LTS release /*! \fn QColor::QColor(const QString &name) - \deprecated [6.6] Use fromString() instead. - Constructs a named color in the same way as setNamedColor() using the given \a name. @@ -801,8 +799,6 @@ QColor::QColor(Spec spec) noexcept /*! \fn QColor::QColor(const char *name) - \deprecated [6.6] Use fromString() instead. - Constructs a named color in the same way as setNamedColor() using the given \a name. @@ -813,8 +809,6 @@ QColor::QColor(Spec spec) noexcept /*! \fn QColor::QColor(QLatin1StringView name) - \deprecated [6.6] Use fromString() instead. - Constructs a named color in the same way as setNamedColor() using the given \a name. @@ -822,7 +816,6 @@ QColor::QColor(Spec spec) noexcept \since 5.8 \sa setNamedColor(), name(), isValid() */ -#endif // QT_DEPRECATED_SINCE(6, 6) /*! \fn bool QColor::isValid() const @@ -1261,15 +1254,12 @@ void QColor::getRgbF(float *r, float *g, float *b, float *a) const if (!r || !g || !b) return; - if (cspec == Invalid) - return; - - if (cspec != Rgb && cspec != ExtendedRgb) { + if (cspec != Invalid && cspec != Rgb && cspec != ExtendedRgb) { toRgb().getRgbF(r, g, b, a); return; } - if (cspec == Rgb) { + if (cspec == Rgb || cspec == Invalid) { *r = ct.argb.red / float(USHRT_MAX); *g = ct.argb.green / float(USHRT_MAX); *b = ct.argb.blue / float(USHRT_MAX); @@ -1493,7 +1483,7 @@ void QColor::setAlpha(int alpha) QCOLOR_INT_RANGE_CHECK("QColor::setAlpha", alpha); if (cspec == ExtendedRgb) { constexpr float f = 1.0f / 255; - castF16(ct.argbExtended.alphaF16) = alpha * f; + castF16(ct.argbExtended.alphaF16) = qfloat16(alpha * f); return; } ct.argb.alpha = alpha * 0x101; @@ -1522,7 +1512,7 @@ void QColor::setAlphaF(float alpha) { QCOLOR_REAL_RANGE_CHECK("QColor::setAlphaF", alpha); if (cspec == ExtendedRgb) { - castF16(ct.argbExtended.alphaF16) = alpha; + castF16(ct.argbExtended.alphaF16) = qfloat16(alpha); return; } float tmp = alpha * USHRT_MAX; @@ -1640,7 +1630,7 @@ void QColor::setRedF(float red) if (cspec == Rgb && red >= 0.0f && red <= 1.0f) ct.argb.red = qRound(red * USHRT_MAX); else if (cspec == ExtendedRgb) - castF16(ct.argbExtended.redF16) = red; + castF16(ct.argbExtended.redF16) = qfloat16(red); else setRgbF(red, greenF(), blueF(), alphaF()); } @@ -1672,7 +1662,7 @@ void QColor::setGreenF(float green) if (cspec == Rgb && green >= 0.0f && green <= 1.0f) ct.argb.green = qRound(green * USHRT_MAX); else if (cspec == ExtendedRgb) - castF16(ct.argbExtended.greenF16) = green; + castF16(ct.argbExtended.greenF16) = qfloat16(green); else setRgbF(redF(), green, blueF(), alphaF()); } @@ -1702,7 +1692,7 @@ void QColor::setBlueF(float blue) if (cspec == Rgb && blue >= 0.0f && blue <= 1.0f) ct.argb.blue = qRound(blue * USHRT_MAX); else if (cspec == ExtendedRgb) - castF16(ct.argbExtended.blueF16) = blue; + castF16(ct.argbExtended.blueF16) = qfloat16(blue); else setRgbF(redF(), greenF(), blue, alphaF()); } |