Class: QgsPictureRasterizer¶
Rasterizes and caches a QPicture as a QImage at a requested size.
Allows for background asynchronous regeneration of the cached image at a different size.
This class is useful for generating pre-rendered versions of QPictures for rendering on the main GUI thread, where those pictures are too expensive to draw directly.
Added in version 4.4.
List of all members, including inherited members
Class Hierarchy¶
Base classes¶
Constructor
Methods
Clears the source picture and cached image, canceling any in-progress background render. |
|
Immediately returns the best available QImage for the given targetSize. |
|
Immediately invalidates the current cached image. |
|
Returns |
|
Returns the maximum width or height (in pixels) of the cached QImage. |
|
Returns the current source QPicture. |
|
Sets the maximum width or height (in pixels) of the cached QImage. |
|
Sets the source picture to cache. |
Signals
Emitted when a background rasterization finishes and a new cached image is available. |
- class qgis.core.QgsPictureRasterizer[source]¶
Bases:
QObject- __init__(parent: QObject | None = None)¶
Constructor for QgsPictureRasterizer, with the specified
parentobject.- Parameters:
parent (QObject|None = None)
- clear(self)[source]¶
Clears the source picture and cached image, canceling any in-progress background render.
- image(self, targetSize: QSize) QImage[source]¶
Immediately returns the best available QImage for the given
targetSize.This method never blocks. If no cached image exists for the specified
targetSizeor the cache has been invalidated then the previously cached image is returned, and a background render at the desiredtargetSizewill be started.- Parameters:
targetSize (QSize)
- Return type:
QImage
- isRendering(self) bool[source]¶
Returns
Trueif a background job is currently running or scheduled.- Return type:
bool
- maxCacheSize(self) int[source]¶
Returns the maximum width or height (in pixels) of the cached QImage.
See also
- Return type:
int
- signal rendered[source]¶
Emitted when a background rasterization finishes and a new cached image is available.