From 651329adb5e64b18a005e900e1b9c5e95d70258c Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Fri, 23 Jan 2015 13:09:03 +0400 Subject: Pass params of shareable type by const-ref rather than by value Instead of leaving a note for Qt6 and then forget to do the actual change once again, change APIs now inside QT_VERSION >= QT_VERSION_CHECK(6,0,0) blocks. Change-Id: Ifa769904e304358a9c2accfd6c9f86eeb342f9dc Reviewed-by: Shawn Rutledge Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/gui/image/qimage.cpp | 8 ++++++++ src/gui/image/qimage.h | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 57e7c9a7ab..e6f86fceaa 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -1351,7 +1351,11 @@ int QImage::colorCount() const \sa colorTable(), setColor(), {QImage#Image Transformations}{Image Transformations} */ +#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) +void QImage::setColorTable(const QVector &colors) +#else void QImage::setColorTable(const QVector colors) +#endif { if (!d) return; @@ -1361,7 +1365,11 @@ void QImage::setColorTable(const QVector colors) if (!d) return; +#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) + d->colortable = colors; +#else d->colortable = qMove(const_cast&>(colors)); +#endif d->has_alpha_clut = false; for (int i = 0; i < d->colortable.size(); ++i) { if (qAlpha(d->colortable.at(i)) != 255) { diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index acfdc6fd7b..4ce99b9ab1 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -220,7 +220,11 @@ public: void setPixel(const QPoint &pt, uint index_or_rgb); QVector colorTable() const; - void setColorTable(const QVector colors); // ### Qt 6: remove const +#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) + void setColorTable(const QVector &colors); +#else + void setColorTable(const QVector colors); +#endif qreal devicePixelRatio() const; void setDevicePixelRatio(qreal scaleFactor); -- cgit v1.2.3