summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qpixmap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/image/qpixmap.cpp')
-rw-r--r--src/gui/image/qpixmap.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index dc38a0a580..fa00e95f3c 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -579,7 +579,7 @@ int QPixmap::height() const
*/
QSize QPixmap::size() const
{
- return data ? QSize(data->width(), data->height()) : QSize();
+ return data ? QSize(data->width(), data->height()) : QSize(0, 0);
}
/*!
@@ -1170,15 +1170,24 @@ QPixmap QPixmap::grabWidget(QWidget * widget, const QRect &rect)
\warning This function is X11 specific; using it is non-portable.
+ \warning Since 4.8, pixmaps do not have an X11 handle unless
+ created with \l {QPixmap::}{fromX11Pixmap()}, or if the native
+ graphics system is explicitly enabled.
+
\sa detach()
+ \sa QApplication::setGraphicsSystem()
*/
Qt::HANDLE QPixmap::handle() const
{
#if defined(Q_WS_X11)
const QPixmapData *pd = pixmapData();
- if (pd && pd->classId() == QPixmapData::X11Class)
- return static_cast<const QX11PixmapData*>(pd)->handle();
+ if (pd) {
+ if (pd->classId() == QPixmapData::X11Class)
+ return static_cast<const QX11PixmapData*>(pd)->handle();
+ else
+ qWarning("QPixmap::handle(): Pixmap is not an X11 class pixmap");
+ }
#endif
return 0;
}