diff --git a/src/quickgui/qgsquickmapcanvasmap.cpp b/src/quickgui/qgsquickmapcanvasmap.cpp index 472c00c06eb0..9bf5e2cd37c0 100644 --- a/src/quickgui/qgsquickmapcanvasmap.cpp +++ b/src/quickgui/qgsquickmapcanvasmap.cpp @@ -18,8 +18,10 @@ #include #include "qgis.h" +#include "qgsannotationlayer.h" #include "qgsexpressioncontextutils.h" #include "qgsgrouplayer.h" +#include "qgslabelingresults.h" #include "qgsmaplayerelevationproperties.h" #include "qgsmaplayertemporalproperties.h" #include "qgsmaprenderercache.h" @@ -27,9 +29,8 @@ #include "qgsmessagelog.h" #include "qgspallabeling.h" #include "qgsproject.h" -#include "qgsannotationlayer.h" +#include "qgssymbollayerutils.h" #include "qgsvectorlayer.h" -#include "qgslabelingresults.h" #include "qgsquickmapcanvasmap.h" #include "qgsquickmapsettings.h" @@ -513,9 +514,23 @@ void QgsQuickMapCanvasMap::clearTemporalCache() const QList layerList = mMapSettings->mapSettings().layers(); for ( QgsMapLayer *layer : layerList ) { + bool alreadyInvalidatedThisLayer = false; + if ( QgsVectorLayer *vl = qobject_cast< QgsVectorLayer * >( layer ) ) + { + if ( vl->renderer() && QgsSymbolLayerUtils::rendererFrameRate( vl->renderer() ) > -1 ) + { + // layer has an animated symbol assigned, so we have to redraw it regardless of whether + // or not it has temporal settings + mCache->invalidateCacheForLayer( layer ); + alreadyInvalidatedThisLayer = true; + // we can't shortcut and "continue" here, as we still need to check whether the layer + // will cause label invalidation using the logic below + } + } + if ( layer->temporalProperties() && layer->temporalProperties()->isActive() ) { - if ( QgsVectorLayer *vl = qobject_cast( layer ) ) + if ( QgsVectorLayer *vl = qobject_cast< QgsVectorLayer * >( layer ) ) { if ( vl->labelsEnabled() || vl->diagramsEnabled() ) invalidateLabels = true; @@ -524,7 +539,23 @@ void QgsQuickMapCanvasMap::clearTemporalCache() if ( layer->temporalProperties()->flags() & QgsTemporalProperty::FlagDontInvalidateCachedRendersWhenRangeChanges ) continue; - mCache->invalidateCacheForLayer( layer ); + if ( !alreadyInvalidatedThisLayer ) + mCache->invalidateCacheForLayer( layer ); + } + else if ( QgsGroupLayer *gl = qobject_cast( layer ) ) + { + const QList childLayerList = gl->childLayers(); + for ( QgsMapLayer *childLayer : childLayerList ) + { + if ( childLayer->temporalProperties() && childLayer->temporalProperties()->isActive() ) + { + if ( childLayer->temporalProperties()->flags() & QgsTemporalProperty::FlagDontInvalidateCachedRendersWhenRangeChanges ) + continue; + + mCache->invalidateCacheForLayer( layer ); + break; + } + } } }