diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2014-09-02 10:32:43 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2014-09-02 20:43:07 +0200 |
commit | 5b9e566b4d009ddb79f4c7d7e17ef0b8b4024859 (patch) | |
tree | dbfc192f30daa18a0b364a664f7c636b592283aa /src/gui/image/qimage.h | |
parent | b04c14429734614fdb7c846a0c319512acee47cd (diff) |
QImage: add a qMove()
The color table is passed by value (good for C++11), so when
the argument is assigned to the member variable, that's a good
spot for a move assignment.
However, the argument is also declared const.
The standard says that top-level const is ignored, but some
compilers (I know about SunCC) think differently, so we cannot
remove it.
Instead, we do a const_cast. It is well-defined: Even though
apparently the argument was declared as const, the standard
says the const is not there, and no sane compiler would put
the argument copy into read-only memory.
Add a reminder to remove the top-level const from the
signature come Qt 6.
Change-Id: Iac18846ba669de0a30da620685ad1438c267e193
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/gui/image/qimage.h')
-rw-r--r-- | src/gui/image/qimage.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index 844bbb2eba..3e73462efc 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -232,7 +232,7 @@ public: void setPixel(const QPoint &pt, uint index_or_rgb); QVector<QRgb> colorTable() const; - void setColorTable(const QVector<QRgb> colors); + void setColorTable(const QVector<QRgb> colors); // ### Qt 6: remove const qreal devicePixelRatio() const; void setDevicePixelRatio(qreal scaleFactor); |