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.

Public Functions

(obsolete) void fill (const QPaintDevice * device , const QPoint & p )
(obsolete) void fill (const QPaintDevice * device , int x , int y )
(obsolete) int serialNumber () const

Static Public Members

(obsolete) QPixmap grabWidget (QObject * widget , const QRect & rectangle )
(obsolete) QPixmap grabWidget (QObject * widget , int x = 0, int y = 0, int w = -1, int h = -1)
(obsolete) QPixmap 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 )

Use QPainter or the fill( QColor ) overload instead.

void QPixmap:: fill (const QPaintDevice * device , int x , int y )

Use QPainter or the fill( QColor ) overload instead.

[static] QPixmap QPixmap:: grabWidget ( QObject * widget , const QRect & rectangle )

Use QWidget::grab () instead.

[static] QPixmap QPixmap:: grabWidget ( QObject * widget , int x = 0, int y = 0, int w = -1, int h = -1)

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.

See also grabWidget (), Screenshot Example , and QScreen .

int QPixmap:: serialNumber () const

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.