The following members of class QPixmap are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.
||fill(const QPaintDevice *device, const QPoint &p)|
||fill(const QPaintDevice *device, int x, int y)|
||grabWidget(QObject *widget, const QRect &rectangle)|
||grabWidget(QObject *widget, int x = 0, int y = 0, int w = -1, int h = -1)|
||grabWindow(WId window, int x = 0, int y = 0, int width = -1, int height = -1)|
Use QWidget::grab() instead.
Use QWidget::grab() instead.
[static]QPixmap QPixmap::grabWindow(WId window, int x = 0, int y = 0, int width = -1, int height = -1)
Creates and returns a pixmap constructed by grabbing the contents of the given window restricted by QRect(x, y, width, height).
The arguments (x, y) specify the offset in the window, whereas (width, height) specify the area to be copied. If width is negative, the function copies everything to the right border of the window. If height is negative, the function copies everything to the bottom of the window.
The window system identifier (
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 window doesn't have the same depth as the root window, and another window partially or entirely obscures the one you grab, you will 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 (
WId) are local to a screen. Use QScreen::grabWindow() instead.
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.
As part of the free Business evaluation, we offer a free welcome call for companies, to talk about your requirements, and how the Felgo SDK & Services can help you. Just sign up and schedule your call.
Sign up now to start your free Business evaluation: