Class: QgsMapRendererTask¶
QgsTask task which draws a map to an image file or a painter
as a background task.
This can be used to draw maps without blocking the QGIS interface.
List of all members, including inherited members
Class Hierarchy¶
Base classes¶
Abstract base class for long running background tasks. |
|
Classes
Methods
Adds annotations to be rendered on the map. |
|
Adds decorations to be rendered on the map. |
|
Sets whether metadata such as title and subject will be exported whenever possible. |
|
Sets whether the image file will be georeferenced (embedded or via a world file). |
Signals
Emitted when map rendering failed. |
|
Emitted when the map rendering is successfully completed. |
Attributes
- class qgis.core.QgsMapRendererTask[source]¶
Bases:
QgsTask- __init__(ms: QgsMapSettings, fileName: str | None, fileFormat: str | None = '', forceRaster: bool = False, flags: QgsTask.Flags | QgsTask.Flag = QgsTask.CanCancel)
Constructor for QgsMapRendererTask to render a map to an image file.
Since QGIS 3.26 the optional
flagsargument can be used to control the task flags.- Parameters:
ms (QgsMapSettings)
fileName (Optional[str])
fileFormat (Optional[str] = '')
forceRaster (bool = False)
flags (Union[QgsTask.Flags, QgsTask.Flag] = QgsTask.CanCancel)
- __init__(ms: QgsMapSettings, p: QPainter | None)
Constructor for QgsMapRendererTask to render a map to a QPainter object.
- Parameters:
ms (QgsMapSettings)
p (Optional[QPainter])
- class ErrorType¶
Bases:
int
- ImageAllocationFail = 1¶
- ImageSaveFail = 2¶
- ImageUnsupportedFormat = 3¶
- addAnnotations(self, annotations: Iterable[QgsAnnotation])[source]¶
Adds
annotationsto be rendered on the map.- Parameters:
annotations (Iterable[QgsAnnotation])
- addDecorations(self, decorations: Iterable[QgsMapDecoration])[source]¶
Adds
decorationsto be rendered on the map.- Parameters:
decorations (Iterable[QgsMapDecoration])
- signal errorOccurred(error: int)[source]¶
Emitted when map rendering failed.
- Parameters:
error (int)