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.
Class Hierarchy¶
Base classes¶
Abstract base class for long running background tasks. |
|
- 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[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- signal renderingComplete[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.