Subgroup: Map

Class: QgsMapRendererCustomPainterJob

class qgis.core.QgsMapRendererCustomPainterJob

Bases: qgis._core.QgsMapRendererJob

Job implementation that renders everything sequentially using a custom painter.

Also supports synchronous rendering in main thread for cases when rendering in background is not an option because of some technical limitations (e.g. printing to printer on some platforms).

New in version 2.4: Methods

blockSignals
cancel
cancelWithoutBlocking
childEvent
children
connectNotify
customEvent
deleteLater
disconnect
disconnectNotify
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
errors List of errors that happened during the rendering job - available when the rendering has been finished
event
eventFilter
featureFilterProvider

New in version 3.0.

findChild findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
findChildren findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
inherits
installEventFilter
isActive
isSignalConnected
isWidgetType
isWindowType
killTimer
mapSettings Return map settings with which this job was started.
metaObject
moveToThread
objectName
parent
property
pyqtConfigure Each keyword argument is either the name of a Qt property or a Qt signal.
receivers
removeEventFilter
renderSynchronously Render the map synchronously in this thread.
renderingTime Returns the total time it took to finish the job (in milliseconds).
sender
senderSignalIndex
setCache Assign a cache to be used for reading and storing rendered images of individual layers.
setFeatureFilterProvider

New in version 3.0.

setObjectName
setParent
setProperty
signalsBlocked
start
startTimer
takeLabelingResults
thread
timerEvent
tr
usedCachedLabels
waitForFinished
waitForFinishedWithEventLoop Wait for the job to be finished - and keep the thread’s event loop running while waiting.

Attributes

destroyed destroyed(self, QObject = None) [signal]
finished emitted when asynchronous rendering is finished (or canceled). [signal]
objectNameChanged objectNameChanged(self, str) [signal]
renderingLayersFinished Emitted when the layers are rendered.
staticMetaObject
cancel(self)
cancelWithoutBlocking(self)
childEvent()
connectNotify()
customEvent()
disconnectNotify()
isActive(self) → bool
isSignalConnected()
receivers()
renderSynchronously(self)

Render the map synchronously in this thread. The function does not return until the map is completely rendered.

This is an alternative to ordinary API (using start() + waiting for finished() signal). Users are discouraged to use this method unless they have a strong reason for doing it. The synchronous rendering blocks the main thread, making the application unresponsive. Also, it is not possible to cancel rendering while it is in progress.

sender()
senderSignalIndex()
start(self)
takeLabelingResults(self) → QgsLabelingResults
timerEvent()
usedCachedLabels(self) → bool
waitForFinished(self)
waitForFinishedWithEventLoop(self, flags: Union[QEventLoop.ProcessEventsFlags, QEventLoop.ProcessEventsFlag] = QEventLoop.AllEvents)

Wait for the job to be finished - and keep the thread’s event loop running while waiting.

With a call to waitForFinished(), the waiting is done with a synchronization primitive and does not involve processing of messages. That may cause issues to code which requires some events to be handled in the main thread. Some plugins hooking into the rendering pipeline may require this in order to work properly - for example, OpenLayers plugin which uses a QWebPage in the main thread.

Ideally the “wait for finished” method should not be used at all. The code triggering rendering should not need to actively wait for rendering to finish.