QBackingStore#

The QBackingStore class provides a drawing area for QWindow . More

Synopsis#

Functions#

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description#

QBackingStore enables the use of QPainter to paint on a QWindow with type RasterSurface. The other way of rendering to a QWindow is through the use of OpenGL with QOpenGLContext .

A QBackingStore contains a buffered representation of the window contents, and thus supports partial updates by using QPainter to only update a sub region of the window contents.

QBackingStore might be used by an application that wants to use QPainter without OpenGL acceleration and without the extra overhead of using the QWidget or QGraphicsView UI stacks. For an example of how to use QBackingStore see the Raster Window Example .

class PySide6.QtGui.QBackingStore(window)#
Parameters:

windowPySide6.QtGui.QWindow

Constructs an empty surface for the given top-level window.

PySide6.QtGui.QBackingStore.beginPaint(arg__1)#
Parameters:

arg__1PySide6.QtGui.QRegion

Begins painting on the backing store surface in the given region.

You should call this function before using the paintDevice() to paint.

PySide6.QtGui.QBackingStore.endPaint()#

Ends painting.

You should call this function after painting with the paintDevice() has ended.

PySide6.QtGui.QBackingStore.flush(region[, window=None[, offset=QPoint()]])#
Parameters:

Flushes the given region from the specified window onto the screen.

The window must either be the top level window represented by this backingstore, or a non-transient child of that window. Passing None falls back to using the backingstore’s top level window.

If the window is a child window, the region should be in child window coordinates, and the offset should be the child window’s offset in relation to the backingstore’s top level window.

You should call this function after ending painting with endPaint() .

PySide6.QtGui.QBackingStore.hasStaticContents()#
Return type:

bool

Returns a boolean indicating if this window has static contents or not.

PySide6.QtGui.QBackingStore.paintDevice()#
Return type:

PySide6.QtGui.QPaintDevice

Returns the paint device for this surface.

Warning

The device is only valid between calls to beginPaint() and endPaint() . You should not cache the returned value.

PySide6.QtGui.QBackingStore.resize(size)#
Parameters:

sizePySide6.QtCore.QSize

Sets the size of the window surface to size.

See also

size()

PySide6.QtGui.QBackingStore.scroll(area, dx, dy)#
Parameters:
Return type:

bool

Scrolls the given area dx pixels to the right and dy downward; both dx and dy may be negative.

Returns true if the area was scrolled successfully; false otherwise.

PySide6.QtGui.QBackingStore.setStaticContents(region)#
Parameters:

regionPySide6.QtGui.QRegion

Set region as the static contents of this window.

See also

staticContents()

PySide6.QtGui.QBackingStore.size()#
Return type:

PySide6.QtCore.QSize

Returns the current size of the window surface.

PySide6.QtGui.QBackingStore.staticContents()#
Return type:

PySide6.QtGui.QRegion

Returns a QRegion representing the area of the window that has static contents.

PySide6.QtGui.QBackingStore.window()#
Return type:

PySide6.QtGui.QWindow

Returns a pointer to the top-level window associated with this surface.