diff options
author | Paul Olav Tvete <paul.tvete@nokia.com> | 2010-07-14 06:55:05 (GMT) |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@nokia.com> | 2010-07-14 06:55:05 (GMT) |
commit | 0832d7209e3aee7055fb39339030ff6842f4117d (patch) | |
tree | 75ec174a5492d0ddc52bc2f4dcdef363714a63cb /src/gui/image/qpixmap.cpp | |
parent | ad0d0c4b6f7958b3cde01855b0f3b9c68db5253a (diff) | |
parent | df28c1203e12c572f795b8d114254a8e5a6619e8 (diff) | |
download | Qt-0832d7209e3aee7055fb39339030ff6842f4117d.zip Qt-0832d7209e3aee7055fb39339030ff6842f4117d.tar.gz Qt-0832d7209e3aee7055fb39339030ff6842f4117d.tar.bz2 |
Merge remote branch 'qt/4.7' into lighthouse-4.7
Conflicts:
src/gui/image/image.pri
src/gui/image/qpixmapdatafactory.cpp
src/gui/painting/qgraphicssystem.cpp
Diffstat (limited to 'src/gui/image/qpixmap.cpp')
-rw-r--r-- | src/gui/image/qpixmap.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 1ae3bef..ef94bf0b 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -2020,7 +2020,7 @@ void QPixmap::detach() the color table. If this is too expensive an operation, you can use QBitmap::fromImage() instead. - \sa toImage(), {QPixmap#Pixmap Conversion}{Pixmap Conversion} + \sa fromImageReader(), toImage(), {QPixmap#Pixmap Conversion}{Pixmap Conversion} */ QPixmap QPixmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags) { @@ -2035,6 +2035,27 @@ QPixmap QPixmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags) } /*! + \fn QPixmap QPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags) + + Create a QPixmap from an image read directly from an \a imageReader. + The \a flags argument is a bitwise-OR of the \l{Qt::ImageConversionFlags}. + Passing 0 for \a flags sets all the default options. + + On some systems, reading an image directly to QPixmap can use less memory than + reading a QImage to convert it to QPixmap. + + \sa fromImage(), toImage(), {QPixmap#Pixmap Conversion}{Pixmap Conversion} +*/ +QPixmap QPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags) +{ + QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); + QScopedPointer<QPixmapData> data(gs ? gs->createPixmapData(QPixmapData::PixmapType) + : QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixmapType)); + data->fromImageReader(imageReader, flags); + return QPixmap(data.take()); +} + +/*! \fn QPixmap QPixmap::grabWindow(WId window, int x, int y, int width, int height) |