From 0fda43cf33cc7715f16d8764c4d96c6f88238712 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Thu, 16 Apr 2020 17:42:00 +0200 Subject: Remove deprecated members from QtGui/image classes Cleaning up those that are trivial to remove because they have direct replacements. Change-Id: I4f5c25884a01474fa2db8b369f0d883bd21edd5b Reviewed-by: Shawn Rutledge --- src/gui/image/qicon.cpp | 18 --- src/gui/image/qicon.h | 3 - src/gui/image/qiconengine.h | 8 +- src/gui/image/qimage.cpp | 93 ------------- src/gui/image/qimage.h | 4 - src/gui/image/qimagereader.cpp | 37 ------ src/gui/image/qimagereader.h | 7 - src/gui/image/qimagewriter.cpp | 65 --------- src/gui/image/qimagewriter.h | 14 -- src/gui/image/qpixmap.cpp | 146 --------------------- src/gui/image/qpixmap.h | 40 ------ src/gui/image/qpixmapcache.cpp | 39 ------ src/gui/image/qpixmapcache.h | 6 - tests/auto/gui/image/qimage/tst_qimage.cpp | 28 ---- .../gui/image/qimagewriter/tst_qimagewriter.cpp | 7 - .../gui/image/qpixmapcache/tst_qpixmapcache.cpp | 30 ----- tests/auto/other/macgui/tst_macgui.cpp | 8 +- 17 files changed, 10 insertions(+), 543 deletions(-) diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 41fe649fc5..36f499711e 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -785,24 +785,6 @@ QIcon::operator QVariant() const return QVariant(QMetaType::QIcon, this); } -/*! \fn int QIcon::serialNumber() const - \obsolete - - Returns a number that identifies the contents of this - QIcon object. Distinct QIcon objects can have - the same serial number if they refer to the same contents - (but they don't have to). Also, the serial number of - a QIcon object may change during its lifetime. - - Use cacheKey() instead. - - A null icon always has a serial number of 0. - - Serial numbers are mostly useful in conjunction with caching. - - \sa QPixmap::serialNumber() -*/ - /*! Returns a number that identifies the contents of this QIcon object. Distinct QIcon objects can have the same key if diff --git a/src/gui/image/qicon.h b/src/gui/image/qicon.h index 735a3e134d..395de48410 100644 --- a/src/gui/image/qicon.h +++ b/src/gui/image/qicon.h @@ -95,9 +95,6 @@ public: bool isDetached() const; void detach(); -#if QT_DEPRECATED_SINCE(5, 0) - QT_DEPRECATED inline int serialNumber() const { return cacheKey() >> 32; } -#endif qint64 cacheKey() const; void addPixmap(const QPixmap &pixmap, Mode mode = Normal, State state = Off); diff --git a/src/gui/image/qiconengine.h b/src/gui/image/qiconengine.h index 89fed5ccda..401c8034eb 100644 --- a/src/gui/image/qiconengine.h +++ b/src/gui/image/qiconengine.h @@ -51,7 +51,6 @@ class Q_GUI_EXPORT QIconEngine { public: QIconEngine(); - QIconEngine(const QIconEngine &other); // ### Qt6: make protected virtual ~QIconEngine(); virtual void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) = 0; virtual QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state); @@ -93,14 +92,13 @@ public: // ### Qt6: move content to proper virtual functions virtual void virtual_hook(int id, void *data); +protected: + QIconEngine(const QIconEngine &other); + private: QIconEngine &operator=(const QIconEngine &other) = delete; }; -#if QT_DEPRECATED_SINCE(5, 0) -typedef QIconEngine QIconEngineV2; -#endif - QT_END_NAMESPACE #endif // QICONENGINE_H diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 5460104fd0..8175ef42c1 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4314,99 +4314,6 @@ void QImage::setAlphaChannel(const QImage &alphaChannel) painter.drawImage(rect(), sourceImage); } - -#if QT_DEPRECATED_SINCE(5, 15) -/*! - \obsolete - - Returns the alpha channel of the image as a new grayscale QImage in which - each pixel's red, green, and blue values are given the alpha value of the - original image. The color depth of the returned image is 8-bit. - - You can see an example of use of this function in QPixmap's - \l{QPixmap::}{alphaChannel()}, which works in the same way as - this function on QPixmaps. - - Most usecases for this function can be replaced with QPainter and - using composition modes. - - Note this returns a color-indexed image if you want the alpha channel in - the alpha8 format instead use convertToFormat(Format_Alpha8) on the source - image. - - \warning This is an expensive function. - - \sa setAlphaChannel(), hasAlphaChannel(), convertToFormat(), - {QPixmap#Pixmap Information}{Pixmap}, - {QImage#Image Transformations}{Image Transformations} -*/ - -QImage QImage::alphaChannel() const -{ - if (!d) - return QImage(); - - int w = d->width; - int h = d->height; - - QImage image(w, h, Format_Indexed8); - image.setColorCount(256); - - // set up gray scale table. - for (int i=0; i<256; ++i) - image.setColor(i, qRgb(i, i, i)); - - if (!hasAlphaChannel()) { - image.fill(255); - return image; - } - - if (d->format == Format_Indexed8) { - const uchar *src_data = d->data; - uchar *dest_data = image.d->data; - for (int y=0; ycolortable.at(*src)); - ++dest; - ++src; - } - src_data += d->bytes_per_line; - dest_data += image.d->bytes_per_line; - } - } else if (d->format == Format_Alpha8) { - const uchar *src_data = d->data; - uchar *dest_data = image.d->data; - memcpy(dest_data, src_data, d->bytes_per_line * h); - } else { - QImage alpha32 = *this; - bool canSkipConversion = (d->format == Format_ARGB32 || d->format == Format_ARGB32_Premultiplied); -#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN - canSkipConversion = canSkipConversion || (d->format == Format_RGBA8888 || d->format == Format_RGBA8888_Premultiplied); -#endif - if (!canSkipConversion) - alpha32 = convertToFormat(Format_ARGB32); - - const uchar *src_data = alpha32.d->data; - uchar *dest_data = image.d->data; - for (int y=0; ybytes_per_line; - dest_data += image.d->bytes_per_line; - } - } - - return image; -} -#endif - /*! Returns \c true if the image has a format that respects the alpha channel, otherwise returns \c false. diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index 138a52ab78..27849a2589 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -229,10 +229,6 @@ public: bool hasAlphaChannel() const; void setAlphaChannel(const QImage &alphaChannel); -#if QT_DEPRECATED_SINCE(5, 15) - QT_DEPRECATED_X("Use convertToFormat(QImage::Format_Alpha8)") - QImage alphaChannel() const; -#endif QImage createAlphaMask(Qt::ImageConversionFlags flags = Qt::AutoColor) const; #ifndef QT_NO_IMAGE_HEURISTIC_MASK QImage createHeuristicMask(bool clipTight = true) const; diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index 5cb7e1328e..684442eb8f 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -1149,43 +1149,6 @@ bool QImageReader::autoTransform() const return false; } -#if QT_DEPRECATED_SINCE(5, 15) -/*! - \since 5.6 - \obsolete Use QColorSpace conversion on the QImage instead. - - This is an image format specific function that forces images with - gamma information to be gamma corrected to \a gamma. For image formats - that do not support gamma correction, this value is ignored. - - To gamma correct to a standard PC color-space, set gamma to \c 1/2.2. - - \sa gamma() -*/ -void QImageReader::setGamma(float gamma) -{ - if (d->initHandler() && d->handler->supportsOption(QImageIOHandler::Gamma)) - d->handler->setOption(QImageIOHandler::Gamma, gamma); -} - -/*! - \since 5.6 - \obsolete Use QImage::colorSpace() and QColorSpace::gamma() instead. - - Returns the gamma level of the decoded image. If setGamma() has been - called and gamma correction is supported it will return the gamma set. - If gamma level is not supported by the image format, \c 0.0 is returned. - - \sa setGamma() -*/ -float QImageReader::gamma() const -{ - if (d->initHandler() && d->handler->supportsOption(QImageIOHandler::Gamma)) - return d->handler->option(QImageIOHandler::Gamma).toFloat(); - return 0.0; -} -#endif - /*! Returns \c true if an image can be read for the device (i.e., the image format is supported, and the device seems to contain valid diff --git a/src/gui/image/qimagereader.h b/src/gui/image/qimagereader.h index 7cd3b81a7d..d40cbb89b8 100644 --- a/src/gui/image/qimagereader.h +++ b/src/gui/image/qimagereader.h @@ -117,13 +117,6 @@ public: void setAutoTransform(bool enabled); bool autoTransform() const; -#if QT_DEPRECATED_SINCE(5, 15) - QT_DEPRECATED_VERSION_X_5_15("Use QColorSpace instead") - void setGamma(float gamma); - QT_DEPRECATED_VERSION_X_5_15("Use QColorSpace instead") - float gamma() const; -#endif - QByteArray subType() const; QList supportedSubTypes() const; diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp index 33f5e491c7..519a222db1 100644 --- a/src/gui/image/qimagewriter.cpp +++ b/src/gui/image/qimagewriter.cpp @@ -497,37 +497,6 @@ int QImageWriter::compression() const return d->compression; } -#if QT_DEPRECATED_SINCE(5, 15) -/*! - \obsolete Use QColorSpace conversion on the QImage instead. - - This is an image format specific function that sets the gamma - level of the image to \a gamma. For image formats that do not - support setting the gamma level, this value is ignored. - - The value range of \a gamma depends on the image format. For - example, the "png" format supports a gamma range from 0.0 to 1.0. - - \sa quality() -*/ -void QImageWriter::setGamma(float gamma) -{ - d->gamma = gamma; -} - -/*! - \obsolete Use QImage::colorSpace() and QColorSpace::gamma() instead. - - Returns the gamma level of the image. - - \sa setGamma() -*/ -float QImageWriter::gamma() const -{ - return d->gamma; -} -#endif - /*! \since 5.4 @@ -653,40 +622,6 @@ QImageIOHandler::Transformations QImageWriter::transformation() const return d->transformation; } -#if QT_DEPRECATED_SINCE(5, 13) -/*! - \obsolete - - Use setText() instead. - - This is an image format specific function that sets the - description of the image to \a description. For image formats that - do not support setting the description, this value is ignored. - - The contents of \a description depends on the image format. - - \sa description() -*/ -void QImageWriter::setDescription(const QString &description) -{ - d->description = description; -} - -/*! - \obsolete - - Use QImageReader::text() instead. - - Returns the description of the image. - - \sa setDescription() -*/ -QString QImageWriter::description() const -{ - return d->description; -} -#endif - /*! \since 4.1 diff --git a/src/gui/image/qimagewriter.h b/src/gui/image/qimagewriter.h index 5c8ed7e211..3969acbe80 100644 --- a/src/gui/image/qimagewriter.h +++ b/src/gui/image/qimagewriter.h @@ -84,13 +84,6 @@ public: void setCompression(int compression); int compression() const; -#if QT_DEPRECATED_SINCE(5, 15) - QT_DEPRECATED_VERSION_X_5_15("Use QColorSpace instead") - void setGamma(float gamma); - QT_DEPRECATED_VERSION_X_5_15("Use QColorSpace instead") - float gamma() const; -#endif - void setSubType(const QByteArray &type); QByteArray subType() const; QList supportedSubTypes() const; @@ -104,13 +97,6 @@ public: QImageIOHandler::Transformations transformation() const; void setTransformation(QImageIOHandler::Transformations orientation); -#if QT_DEPRECATED_SINCE(5, 13) - QT_DEPRECATED_X("Use QImageWriter::setText() instead") - void setDescription(const QString &description); - QT_DEPRECATED_X("Use QImageReader::text() instead") - QString description() const; -#endif - void setText(const QString &key, const QString &text); bool canWrite() const; diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index a4c5296d9f..bf20a9066b 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -845,37 +845,6 @@ bool QPixmap::doImageIO(QImageWriter *writer, int quality) const } -#if QT_DEPRECATED_SINCE(5, 13) -/*! - \obsolete - - Use QPainter or the fill(QColor) overload instead. -*/ - -void QPixmap::fill(const QPaintDevice *device, const QPoint &p) -{ - Q_UNUSED(device) - Q_UNUSED(p) - qWarning("this function is deprecated, ignored"); -} - - -/*! - \fn void QPixmap::fill(const QPaintDevice *device, int x, int y) - \obsolete - - Use QPainter or the fill(QColor) overload instead. -*/ -void QPixmap::fill(const QPaintDevice *device, int xofs, int yofs) -{ - Q_UNUSED(device) - Q_UNUSED(xofs) - Q_UNUSED(yofs) - qWarning("this function is deprecated, ignored"); -} -#endif - - /*! Fills the pixmap with the given \a color. @@ -911,21 +880,6 @@ void QPixmap::fill(const QColor &color) data->fill(color); } -/*! \fn int QPixmap::serialNumber() const - \obsolete - Returns a number that identifies the contents of this QPixmap - object. Distinct QPixmap objects can only have the same serial - number if they refer to the same contents (but they don't have - to). - - Use cacheKey() instead. - - \warning The serial number doesn't necessarily change when - the pixmap is altered. This means that it may be dangerous to use - it as a cache key. For caching pixmaps, we recommend using the - QPixmapCache class whenever possible. -*/ - /*! Returns a number that identifies this QPixmap. Distinct QPixmap objects can only have the same cache key if they refer to the same @@ -957,38 +911,6 @@ static void sendResizeEvents(QWidget *target) } #endif -#if QT_DEPRECATED_SINCE(5, 13) -/*! - \obsolete - - Use QWidget::grab() instead. -*/ -QPixmap QPixmap::grabWidget(QObject *widget, const QRect &rectangle) -{ - QPixmap pixmap; - qWarning("QPixmap::grabWidget is deprecated, use QWidget::grab() instead"); - if (!widget) - return pixmap; - QMetaObject::invokeMethod(widget, "grab", Qt::DirectConnection, - Q_RETURN_ARG(QPixmap, pixmap), - Q_ARG(QRect, rectangle)); - return pixmap; -} - -/*! - \fn QPixmap QPixmap::grabWidget(QObject *widget, int x, int y, int w, int h) - \obsolete - - Use QWidget::grab() instead. -*/ -QPixmap QPixmap::grabWidget(QObject *widget, int x, int y, int w, int h) -{ -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED - return grabWidget(widget, QRect(x, y, w, h)); -QT_WARNING_POP -} -#endif /***************************************************************************** QPixmap stream functions @@ -1582,62 +1504,6 @@ QPixmap QPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionF return QPixmap(data.take()); } -#if QT_DEPRECATED_SINCE(5, 13) -/*! - \fn QPixmap QPixmap::grabWindow(WId window, int x, int y, int - width, int height) - - Creates and returns a pixmap constructed by grabbing the contents - of the given \a window restricted by QRect(\a x, \a y, \a width, - \a height). - - The arguments (\a{x}, \a{y}) specify the offset in the window, - whereas (\a{width}, \a{height}) specify the area to be copied. If - \a width is negative, the function copies everything to the right - border of the window. If \a height is negative, the function - copies everything to the bottom of the window. - - The window system identifier (\c WId) can be retrieved using the - QWidget::winId() function. The rationale for using a window - identifier and not a QWidget, is to enable grabbing of windows - that are not part of the application, window system frames, and so - on. - - The grabWindow() function grabs pixels from the screen, not from - the window, i.e. if there is another window partially or entirely - over the one you grab, you get pixels from the overlying window, - too. The mouse cursor is generally not grabbed. - - Note on X11 that if the given \a window doesn't have the same depth - as the root window, and another window partially or entirely - obscures the one you grab, you will \e not get pixels from the - overlying window. The contents of the obscured areas in the - pixmap will be undefined and uninitialized. - - On Windows Vista and above grabbing a layered window, which is - created by setting the Qt::WA_TranslucentBackground attribute, will - not work. Instead grabbing the desktop widget should work. - - \warning In general, grabbing an area outside the screen is not - safe. This depends on the underlying window system. - - \warning The function is deprecated in Qt 5.0 since there might be - platform plugins in which window system identifiers (\c WId) - are local to a screen. Use QScreen::grabWindow() instead. - - \sa grabWidget(), {Screenshot Example} - \sa QScreen - \deprecated -*/ - -QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) -{ - qWarning("this function is deprecated, use QScreen::grabWindow() instead." - " Defaulting to primary screen."); - return QGuiApplication::primaryScreen()->grabWindow(window, x, y, w, h); -} -#endif - /*! \internal */ @@ -1665,16 +1531,4 @@ QDebug operator<<(QDebug dbg, const QPixmap &r) } #endif -/*! - \fn QPixmap QPixmap::alphaChannel() const - - Most use cases for this can be achieved using a QPainter and QPainter::CompositionMode instead. -*/ - -/*! - \fn void QPixmap::setAlphaChannel(const QPixmap &p) - - Most use cases for this can be achieved using \a p with QPainter and QPainter::CompositionMode instead. -*/ - QT_END_NAMESPACE diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index 2708d267b9..568ed6ecb5 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -92,12 +92,6 @@ public: static int defaultDepth(); void fill(const QColor &fillColor = Qt::white); -#if QT_DEPRECATED_SINCE(5, 13) - QT_DEPRECATED_X("Use QPainter or fill(QColor)") - void fill(const QPaintDevice *device, const QPoint &ofs); - QT_DEPRECATED_X("Use QPainter or fill(QColor)") - void fill(const QPaintDevice *device, int xofs, int yofs); -#endif QBitmap mask() const; void setMask(const QBitmap &); @@ -113,15 +107,6 @@ public: #endif QBitmap createMaskFromColor(const QColor &maskColor, Qt::MaskMode mode = Qt::MaskInColor) const; -#if QT_DEPRECATED_SINCE(5, 13) - QT_DEPRECATED_X("Use QScreen::grabWindow() instead") - static QPixmap grabWindow(WId, int x = 0, int y = 0, int w = -1, int h = -1); - QT_DEPRECATED_X("Use QWidget::grab() instead") - static QPixmap grabWidget(QObject *widget, const QRect &rect); - QT_DEPRECATED_X("Use QWidget::grab() instead") - static QPixmap grabWidget(QObject *widget, int x = 0, int y = 0, int w = -1, int h = -1); -#endif - inline QPixmap scaled(int w, int h, Qt::AspectRatioMode aspectMode = Qt::IgnoreAspectRatio, Qt::TransformationMode mode = Qt::FastTransformation) const { return scaled(QSize(w, h), aspectMode, mode); } @@ -154,9 +139,6 @@ public: inline void scroll(int dx, int dy, int x, int y, int width, int height, QRegion *exposed = nullptr); void scroll(int dx, int dy, const QRect &rect, QRegion *exposed = nullptr); -#if QT_DEPRECATED_SINCE(5, 0) - QT_DEPRECATED inline int serialNumber() const { return cacheKey() >> 32; } -#endif qint64 cacheKey() const; bool isDetached() const; @@ -168,11 +150,6 @@ public: inline bool operator!() const { return isNull(); } -#if QT_DEPRECATED_SINCE(5, 0) - QT_DEPRECATED inline QPixmap alphaChannel() const; - QT_DEPRECATED inline void setAlphaChannel(const QPixmap &); -#endif - protected: int metric(PaintDeviceMetric) const override; static QPixmap fromImageInPlace(QImage &image, Qt::ImageConversionFlags flags = Qt::AutoColor); @@ -222,23 +199,6 @@ inline bool QPixmap::loadFromData(const QByteArray &buf, const char *format, return loadFromData(reinterpret_cast(buf.constData()), buf.size(), format, flags); } -#if QT_DEPRECATED_SINCE(5, 0) -inline QPixmap QPixmap::alphaChannel() const -{ - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - return QPixmap::fromImage(toImage().alphaChannel()); - QT_WARNING_POP -} - -inline void QPixmap::setAlphaChannel(const QPixmap &p) -{ - QImage image = toImage(); - image.setAlphaChannel(p.toImage()); - *this = QPixmap::fromImage(image); - -} -#endif /***************************************************************************** QPixmap stream functions diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp index 118d8c57e8..2fca322543 100644 --- a/src/gui/image/qpixmapcache.cpp +++ b/src/gui/image/qpixmapcache.cpp @@ -482,45 +482,6 @@ QPixmapCacheEntry::~QPixmapCacheEntry() pm_cache()->releaseKey(key); } -#if QT_DEPRECATED_SINCE(5, 13) -/*! - \obsolete - \overload - - Use bool find(const QString &, QPixmap *) instead. - - Returns the pixmap associated with the \a key in the cache, or - null if there is no such pixmap. - - \warning If valid, you should copy the pixmap immediately (this is - fast). Subsequent insertions into the cache could cause the - pointer to become invalid. For this reason, we recommend you use - bool find(const QString&, QPixmap*) instead. - - Example: - \snippet code/src_gui_image_qpixmapcache.cpp 0 -*/ - -QPixmap *QPixmapCache::find(const QString &key) -{ - if (!qt_pixmapcache_thread_test()) - return nullptr; - return pm_cache()->object(key); -} - - -/*! - \obsolete - - Use bool find(const QString &, QPixmap *) instead. -*/ - -bool QPixmapCache::find(const QString &key, QPixmap &pixmap) -{ - return find(key, &pixmap); -} -#endif - /*! Looks for a cached pixmap associated with the given \a key in the cache. If the pixmap is found, the function sets \a pixmap to that pixmap and diff --git a/src/gui/image/qpixmapcache.h b/src/gui/image/qpixmapcache.h index 55af35a5d9..757e024808 100644 --- a/src/gui/image/qpixmapcache.h +++ b/src/gui/image/qpixmapcache.h @@ -74,12 +74,6 @@ public: static int cacheLimit(); static void setCacheLimit(int); -#if QT_DEPRECATED_SINCE(5, 13) - QT_DEPRECATED_X("Use bool find(const QString &, QPixmap *) instead") - static QPixmap *find(const QString &key); - QT_DEPRECATED_X("Use bool find(const QString &, QPixmap *) instead") - static bool find(const QString &key, QPixmap &pixmap); -#endif static bool find(const QString &key, QPixmap *pixmap); static bool find(const Key &key, QPixmap *pixmap); static bool insert(const QString &key, const QPixmap &pixmap); diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index fe998c7d92..9455e2b6e8 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -70,8 +70,6 @@ private slots: void setAlphaChannel_data(); void setAlphaChannel(); - void alphaChannel(); - void convertToFormat_data(); void convertToFormat(); void convertToFormatWithColorTable(); @@ -544,32 +542,6 @@ void tst_QImage::setAlphaChannel() } } QVERIFY(allPixelsOK); - - QImage outAlpha = image.alphaChannel(); - QCOMPARE(outAlpha.size(), image.size()); - - bool allAlphaOk = true; - for (int y=0; y #include #include +#include #include @@ -53,7 +54,12 @@ private slots: QPixmap grabWindowContents(QWidget * widget) { - return QPixmap::grabWindow(widget->winId()); + QScreen *screen = widget->window()->windowHandle()->screen(); + if (!screen) { + qWarning() << "Grabbing pixmap failed, no QScreen for" << widget; + return QPixmap(); + } + return screen->grabWindow(widget->winId()); } /* -- cgit v1.2.3