summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qpixmap.cpp
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2010-02-01 01:03:16 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2010-02-01 01:03:16 (GMT)
commita16a6e6fb3cf9d9c70515d2361bc06c598c27f3f (patch)
tree5895900d5f4d351e3f8a2000868886a9a24f66f7 /src/gui/image/qpixmap.cpp
parent2f3bf7b546186b9415f2d0b97ae431fea1a2cc48 (diff)
downloadQt-a16a6e6fb3cf9d9c70515d2361bc06c598c27f3f.zip
Qt-a16a6e6fb3cf9d9c70515d2361bc06c598c27f3f.tar.gz
Qt-a16a6e6fb3cf9d9c70515d2361bc06c598c27f3f.tar.bz2
Promote QPixmap::convertFromImage() to public API from Qt3Support
QPixmap::fromImage() creates a new pixmap from a QImage. There was no way to replace a pixmap with a new QImage in-place without using the private QPixmapData API. This change promotes the Qt3Support function convertFromImage() back to official status for updating a pixmap in-place. Task-number: QTBUG-7361 Reviewed-by: Tom Cooksey
Diffstat (limited to 'src/gui/image/qpixmap.cpp')
-rw-r--r--src/gui/image/qpixmap.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 5626485..fe03c93 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -1379,10 +1379,26 @@ void QPixmap::deref()
*/
/*!
- \fn bool QPixmap::convertFromImage(const QImage &image, Qt::ImageConversionFlags flags)
+ Replaces this pixmap's data with the given \a image using the specified
+ \a flags to control the conversion. The \a flags argument is a
+ bitwise-OR of the \l{Qt::ImageConversionFlags}. Passing 0 for \a
+ flags sets all the default options.
- Use the static fromImage() function instead.
+ Note: this function was part of Qt 3 support in Qt 4.6 and earlier.
+ It has been promoted to official API status in 4.7 to support updating
+ the pixmap's image without creating a new QPixmap as fromImage() would.
+
+ \sa fromImage()
+ \since 4.7
*/
+bool QPixmap::convertFromImage(const QImage &image, Qt::ImageConversionFlags flags)
+{
+ if (image.isNull() || !data)
+ *this = QPixmap::fromImage(image, flags);
+ else
+ data->fromImage(image, flags);
+ return !isNull();
+}
/*!
\fn QPixmap QPixmap::xForm(const QMatrix &matrix) const