diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 2646d298e9..499c527cfc 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2149,12 +2149,7 @@ static QImage convertWithPalette(const QImage &src, QImage::Format format, QImage dest(src.size(), format); dest.setColorTable(clut); - QString textsKeys = src.text(); - const auto textKeyList = textsKeys.splitRef(QLatin1Char('\n'), Qt::SkipEmptyParts); - for (const auto &textKey : textKeyList) { - const auto textKeySplitted = textKey.split(QLatin1String(": ")); - dest.setText(textKeySplitted[0].toString(), textKeySplitted[1].toString()); - } + QImageData::get(dest)->text = QImageData::get(src)->text; int h = src.height(); int w = src.width(); diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index 56824e5ee7..b11aa9d9d0 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -385,6 +385,7 @@ private: friend class QRasterPlatformPixmap; friend class QBlittablePlatformPixmap; friend class QPixmapCacheEntry; + friend struct QImageData; public: typedef QImageData * DataPtr; diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h index 0930955f5a..03ec43eaf7 100644 --- a/src/gui/image/qimage_p.h +++ b/src/gui/image/qimage_p.h @@ -69,6 +69,9 @@ struct Q_GUI_EXPORT QImageData { // internal image data static QImageData *create(const QSize &size, QImage::Format format); static QImageData *create(uchar *data, int w, int h, int bpl, QImage::Format format, bool readOnly, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr); + static QImageData *get(QImage &img) noexcept { return img.d; } + static const QImageData *get(const QImage &img) noexcept { return img.d; } + QAtomicInt ref; int width;