Obsolete Members for QPixmap
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)|
| ||serialNumber() const|
Static Public Members
| ||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)|
Member Function Documentation
void QPixmap::fill(const QPaintDevice *device, const QPoint &p)
void QPixmap::fill(const QPaintDevice *device, int x, int y)
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.
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.