summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qimage.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2014-09-02 10:32:43 +0200
committerMarc Mutz <marc.mutz@kdab.com>2014-09-02 20:43:07 +0200
commit5b9e566b4d009ddb79f4c7d7e17ef0b8b4024859 (patch)
treedbfc192f30daa18a0b364a664f7c636b592283aa /src/gui/image/qimage.cpp
parentb04c14429734614fdb7c846a0c319512acee47cd (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.cpp')
-rw-r--r--src/gui/image/qimage.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index c3b4b1444a..5de686c1ea 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -1368,7 +1368,7 @@ void QImage::setColorTable(const QVector<QRgb> colors)
if (!d)
return;
- d->colortable = colors;
+ d->colortable = qMove(const_cast<QVector<QRgb>&>(colors));
d->has_alpha_clut = false;
for (int i = 0; i < d->colortable.size(); ++i) {
if (qAlpha(d->colortable.at(i)) != 255) {