From 264ad32827f3e65bd2730f6e4e6a22d41209b5b9 Mon Sep 17 00:00:00 2001 From: Sven Pauli Date: Sat, 20 Jan 2018 09:47:38 +0100 Subject: Add const overloads for QColor::getCmyk and QColor::getCmykF Align the constness of QColor::getCmyk and QColor::getCmykF with the rest of the family (QColor::getRgb etc.) by adding overloads. The non-const methods could be removed with the next major release as that will break binary compatibility. Task-number: QTBUG-65176 Change-Id: I8579928a43fb59aed3319ff73481994a54b274f8 Reviewed-by: Christian Ehrlicher Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Timur Pocheptsov --- src/gui/painting/qcolor.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/gui/painting/qcolor.cpp') diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 1d7375d1df..ef3296a6d4 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -2487,6 +2487,15 @@ QColor QColor::fromHslF(qreal h, qreal s, qreal l, qreal a) return color; } +/*! + \obsolete + + Use the \c const overload instead. +*/ +void QColor::getCmyk(int *c, int *m, int *y, int *k, int *a) +{ + const_cast(this)->getCmyk(c, m, y, k, a); +} /*! Sets the contents pointed to by \a c, \a m, \a y, \a k, and \a a, to the @@ -2498,7 +2507,7 @@ QColor QColor::fromHslF(qreal h, qreal s, qreal l, qreal a) \sa setCmyk(), {QColor#The CMYK Color Model}{The CMYK Color Model} */ -void QColor::getCmyk(int *c, int *m, int *y, int *k, int *a) +void QColor::getCmyk(int *c, int *m, int *y, int *k, int *a) const { if (!c || !m || !y || !k) return; @@ -2517,6 +2526,16 @@ void QColor::getCmyk(int *c, int *m, int *y, int *k, int *a) *a = ct.acmyk.alpha >> 8; } +/*! + \obsolete + + Use the \c const overload instead. +*/ +void QColor::getCmykF(qreal *c, qreal *m, qreal *y, qreal *k, qreal *a) +{ + const_cast(this)->getCmykF(c, m, y, k, a); +} + /*! Sets the contents pointed to by \a c, \a m, \a y, \a k, and \a a, to the cyan, magenta, yellow, black, and alpha-channel (transparency) components @@ -2527,7 +2546,7 @@ void QColor::getCmyk(int *c, int *m, int *y, int *k, int *a) \sa setCmykF(), {QColor#The CMYK Color Model}{The CMYK Color Model} */ -void QColor::getCmykF(qreal *c, qreal *m, qreal *y, qreal *k, qreal *a) +void QColor::getCmykF(qreal *c, qreal *m, qreal *y, qreal *k, qreal *a) const { if (!c || !m || !y || !k) return; -- cgit v1.2.3