summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qbitmap.h
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-09-11 15:24:17 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-09-17 13:26:50 +0200
commit861c4d854879b4e0358ad2f02d22753c37d57006 (patch)
treeef7584d00ca853682656de1b496af963430fb3f0 /src/gui/image/qbitmap.h
parente8b1e7e3192c258c21f01b85d52b698fe43c73e0 (diff)
Deprecate implicit QPixmap conversion to QBitmap
It is lossy, so should be requested explicitly, using a dedicated fromPixmap factory function. Deprecate the constructor and assignment operator, and make the constructor explicit. [ChangeLog][QtGui][QBitmap] Implicitly constructing and assigning to a QBitmap from a QPixmap has been deprecated, and the respective constructor has been made explicit. Use the fromPixmap factory function instead. Change-Id: I68ce85b26c901415137b664a1db687021d48bae0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/gui/image/qbitmap.h')
-rw-r--r--src/gui/image/qbitmap.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gui/image/qbitmap.h b/src/gui/image/qbitmap.h
index a114db17e0..9052e62db6 100644
--- a/src/gui/image/qbitmap.h
+++ b/src/gui/image/qbitmap.h
@@ -52,12 +52,16 @@ class Q_GUI_EXPORT QBitmap : public QPixmap
{
public:
QBitmap();
- QBitmap(const QPixmap &);
+#if QT_DEPRECATED_SINCE(6, 0)
+ QT_DEPRECATED_VERSION_X_6_0("Use fromPixmap instead.") explicit QBitmap(const QPixmap &);
+#endif
QBitmap(int w, int h);
explicit QBitmap(const QSize &);
explicit QBitmap(const QString &fileName, const char *format = nullptr);
- QBitmap &operator=(const QPixmap &);
+#if QT_DEPRECATED_SINCE(6, 0)
+ QT_DEPRECATED_VERSION_X_6_0("Use fromPixmap instead.") QBitmap &operator=(const QPixmap &);
+#endif
inline void swap(QBitmap &other) { QPixmap::swap(other); } // prevent QBitmap<->QPixmap swaps
operator QVariant() const;
@@ -67,6 +71,7 @@ public:
static QBitmap fromImage(QImage &&image, Qt::ImageConversionFlags flags = Qt::AutoColor);
static QBitmap fromData(const QSize &size, const uchar *bits,
QImage::Format monoFormat = QImage::Format_MonoLSB);
+ static QBitmap fromPixmap(const QPixmap &pixmap);
QBitmap transformed(const QTransform &matrix) const;