Skip to content
Permalink
Browse files
Add layerRendered signal to QgsMapRendererJob
Can be used to provide progress feedback on map render jobs
  • Loading branch information
nyalldawson committed Dec 31, 2021
1 parent cc404c9 commit 79d50657c7528c2f26d4e6980b6476f9c32367cc
@@ -189,6 +189,17 @@ Rendering labels is not yet done. If the fully rendered layer including labels i
:py:func:`~QgsMapRendererJob.finished` instead.

.. versionadded:: 3.0
%End

void layerRendered( const QString &layerId );
%Docstring
Emitted when a layer has completed rendering.

.. note::

the :py:class:`QgsMapRendererParallelJob` subclass does not emit this signal.

.. versionadded:: 3.24
%End

void finished();
@@ -326,6 +326,7 @@ void QgsMapRendererCustomPainterJob::doRender()
mPainter->setOpacity( 1.0 );
}

emit layerRendered( job.layerId );
}

QgsDebugMsgLevel( QStringLiteral( "Done rendering map layers" ), 5 );
@@ -431,6 +431,15 @@ class CORE_EXPORT QgsMapRendererJob : public QObject SIP_ABSTRACT
*/
void renderingLayersFinished();

/**
* Emitted when a layer has completed rendering.
*
* \note the QgsMapRendererParallelJob subclass does not emit this signal.
*
* \since QGIS 3.24
*/
void layerRendered( const QString &layerId );

//! emitted when asynchronous rendering is finished (or canceled).
void finished();

@@ -70,6 +70,7 @@ void QgsMapRendererSequentialJob::startPrivate()
mInternalJob->setCache( mCache );

connect( mInternalJob, &QgsMapRendererJob::finished, this, &QgsMapRendererSequentialJob::internalFinished );
connect( mInternalJob, &QgsMapRendererJob::layerRendered, this, &QgsMapRendererSequentialJob::layerRendered );

mInternalJob->start();
}
@@ -128,6 +128,8 @@ bool QgsMapRendererStagedRenderJob::renderCurrentPart( QPainter *painter )
painter->setOpacity( 1.0 );
}
job.context()->setPainter( nullptr );

emit layerRendered( job.layerId );
}
else
{

0 comments on commit 79d5065

Please sign in to comment.