diff options
author | Paul Olav Tvete <paul.tvete@nokia.com> | 2010-03-01 13:03:22 (GMT) |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@nokia.com> | 2010-03-01 13:17:53 (GMT) |
commit | 19095f432ef7ef424ea8dc89b19e43ed9f031b3e (patch) | |
tree | 159654fbd2066eaea6d6fe78efc9726b5959eb3d /src/gui/image/qpixmap.cpp | |
parent | 196e1484c22f6347061fa433987a86d90e178a55 (diff) | |
parent | 236c3ad7bacf165069b834b62fede6b147cfaf03 (diff) | |
download | Qt-19095f432ef7ef424ea8dc89b19e43ed9f031b3e.zip Qt-19095f432ef7ef424ea8dc89b19e43ed9f031b3e.tar.gz Qt-19095f432ef7ef424ea8dc89b19e43ed9f031b3e.tar.bz2 |
Merge remote branch 'qt/4.7' into lighthouse-4.7
Conflicts:
configure
src/gui/egl/qegl.cpp
src/gui/kernel/qdnd_p.h
Diffstat (limited to 'src/gui/image/qpixmap.cpp')
-rw-r--r-- | src/gui/image/qpixmap.cpp | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 2e2e9e4..985380a 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -1078,6 +1078,9 @@ QPixmap QPixmap::grabWidget(QWidget * widget, const QRect &rect) if (widget->testAttribute(Qt::WA_PendingResizeEvent) || !widget->testAttribute(Qt::WA_WState_Created)) sendResizeEvents(widget); + widget->d_func()->prepareToRender(QRegion(), + QWidget::DrawWindowBackground | QWidget::DrawChildren | QWidget::IgnoreMask); + QRect r(rect); if (r.width() < 0) r.setWidth(widget->width() - rect.x()); @@ -1088,8 +1091,8 @@ QPixmap QPixmap::grabWidget(QWidget * widget, const QRect &rect) return QPixmap(); QPixmap res(r.size()); - widget->render(&res, QPoint(), r, - QWidget::DrawWindowBackground | QWidget::DrawChildren | QWidget::IgnoreMask); + widget->d_func()->render(&res, QPoint(), r, QWidget::DrawWindowBackground + | QWidget::DrawChildren | QWidget::IgnoreMask, true); return res; } @@ -1370,10 +1373,27 @@ 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. Returns true + if the result is that this pixmap is not null. - 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 @@ -1670,10 +1690,9 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) \o The hasAlphaChannel() returns true if the pixmap has a format that - respects the alpha channel, otherwise returns false, while the - hasAlpha() function returns true if the pixmap has an alpha - channel \e or a mask (otherwise false). The mask() function returns - the mask as a QBitmap object, which can be set using setMask(). + respects the alpha channel, otherwise returns false. The hasAlpha(), + setMask() and mask() functions are legacy and should not be used. + They are potentially very slow. The createHeuristicMask() function creates and returns a 1-bpp heuristic mask (i.e. a QBitmap) for this pixmap. It works by @@ -1760,6 +1779,8 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) Returns true if this pixmap has an alpha channel, \e or has a mask, otherwise returns false. + \warning This is potentially an expensive operation. + \sa hasAlphaChannel(), mask() */ bool QPixmap::hasAlpha() const |