From ab64814737c300770ac1d346cbba1e829eaf9fc4 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Thu, 12 Sep 2024 17:09:00 +0700 Subject: [PATCH] [map layer] When saving/loading 'Rendering' category to/from QML, including auto refresh details --- src/core/qgsmaplayer.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/qgsmaplayer.cpp b/src/core/qgsmaplayer.cpp index eea1eaee214f..4213491e8cbd 100644 --- a/src/core/qgsmaplayer.cpp +++ b/src/core/qgsmaplayer.cpp @@ -784,6 +784,8 @@ void QgsMapLayer::writeCommonStyle( QDomElement &layerElement, QDomDocument &doc layerElement.setAttribute( QStringLiteral( "hasScaleBasedVisibilityFlag" ), hasScaleBasedVisibility() ? 1 : 0 ); layerElement.setAttribute( QStringLiteral( "maxScale" ), QString::number( maximumScale() ) ); layerElement.setAttribute( QStringLiteral( "minScale" ), QString::number( minimumScale() ) ); + layerElement.setAttribute( QStringLiteral( "autoRefreshMode" ), qgsEnumValueToKey( mAutoRefreshMode ) ); + layerElement.setAttribute( QStringLiteral( "autoRefreshInterval" ), QString::number( autoRefreshInterval() ) ); } if ( categories.testFlag( Symbology3D ) ) @@ -2240,6 +2242,11 @@ void QgsMapLayer::readCommonStyle( const QDomElement &layerElement, const QgsRea setMaximumScale( layerElement.attribute( QStringLiteral( "maxScale" ) ).toDouble() ); setMinimumScale( layerElement.attribute( QStringLiteral( "minScale" ) ).toDouble() ); } + if ( layerElement.hasAttribute( QStringLiteral( "autoRefreshMode" ) ) ) + { + setAutoRefreshMode( qgsEnumKeyToValue( layerElement.attribute( QStringLiteral( "autoRefreshMode" ) ), Qgis::AutoRefreshMode::Disabled ) ); + setAutoRefreshInterval( layerElement.attribute( QStringLiteral( "autoRefreshInterval" ) ).toInt() ); + } } if ( categories.testFlag( LayerConfiguration ) )