diff --git a/python/core/auto_generated/qgsmaplayer.sip.in b/python/core/auto_generated/qgsmaplayer.sip.in index fa8de3a8987..91822e2b1ec 100644 --- a/python/core/auto_generated/qgsmaplayer.sip.in +++ b/python/core/auto_generated/qgsmaplayer.sip.in @@ -96,6 +96,7 @@ This is the base class for all map layer types (vector, raster). CustomProperties, GeometryOptions, Relations, + Temporal, AllStyleCategories }; typedef QFlags StyleCategories; diff --git a/src/core/mesh/qgsmeshlayer.cpp b/src/core/mesh/qgsmeshlayer.cpp index 37362ed1551..36ea09452a7 100644 --- a/src/core/mesh/qgsmeshlayer.cpp +++ b/src/core/mesh/qgsmeshlayer.cpp @@ -1033,8 +1033,6 @@ bool QgsMeshLayer::readXml( const QDomNode &layer_node, QgsReadWriteContext &con QString errorMsg; readSymbology( layer_node, errorMsg, context ); - // read temporal - temporalProperties()->readXml( layer_node.toElement(), context ); if ( !mTemporalProperties->timeExtent().begin().isValid() ) temporalProperties()->setDefaultsFromDataProviderTemporalCapabilities( dataProvider()->temporalCapabilities() ); @@ -1089,8 +1087,6 @@ bool QgsMeshLayer::writeXml( QDomNode &layer_node, QDomDocument &document, const } layer_node.appendChild( elemExtraDatasets ); } - // write temporal - mTemporalProperties->writeXml( mapLayerNode, document, context ); QDomElement elemStaticDataset = document.createElement( QStringLiteral( "static-active-dataset" ) ); if ( mStaticScalarDatasetIndex.isValid() ) diff --git a/src/core/qgsmaplayer.cpp b/src/core/qgsmaplayer.cpp index 38fd3215960..221ed281a41 100644 --- a/src/core/qgsmaplayer.cpp +++ b/src/core/qgsmaplayer.cpp @@ -53,6 +53,7 @@ #include "qgsvectordataprovider.h" #include "qgsxmlutils.h" #include "qgsstringutils.h" +#include "qgsmaplayertemporalproperties.h" QString QgsMapLayer::extensionPropertyType( QgsMapLayer::PropertyType type ) { @@ -579,6 +580,11 @@ void QgsMapLayer::writeCommonStyle( QDomElement &layerElement, QDomDocument &doc layerElement.appendChild( layerFlagsElem ); } + if ( categories.testFlag( Temporal ) && const_cast< QgsMapLayer * >( this )->temporalProperties() ) + { + const_cast< QgsMapLayer * >( this )->temporalProperties()->writeXml( layerElement, document, context ); + } + // custom properties if ( categories.testFlag( CustomProperties ) ) { @@ -1672,6 +1678,11 @@ void QgsMapLayer::readCommonStyle( const QDomElement &layerElement, const QgsRea } setFlags( flags ); } + + if ( categories.testFlag( Temporal ) && temporalProperties() ) + { + temporalProperties()->readXml( layerElement.toElement(), context ); + } } QUndoStack *QgsMapLayer::undoStack() diff --git a/src/core/qgsmaplayer.h b/src/core/qgsmaplayer.h index b19cab3a817..d2e0fde162a 100644 --- a/src/core/qgsmaplayer.h +++ b/src/core/qgsmaplayer.h @@ -167,8 +167,9 @@ class CORE_EXPORT QgsMapLayer : public QObject CustomProperties = 1 << 11, //!< Custom properties (by plugins for instance) GeometryOptions = 1 << 12, //!< Geometry validation configuration Relations = 1 << 13, //!< Relations + Temporal = 1 << 14, //!< Temporal properties AllStyleCategories = LayerConfiguration | Symbology | Symbology3D | Labeling | Fields | Forms | Actions | - MapTips | Diagrams | AttributeTable | Rendering | CustomProperties | GeometryOptions | Relations, + MapTips | Diagrams | AttributeTable | Rendering | CustomProperties | GeometryOptions | Relations | Temporal, }; Q_ENUM( StyleCategory ) Q_DECLARE_FLAGS( StyleCategories, StyleCategory ) diff --git a/src/core/qgsvectorlayer.cpp b/src/core/qgsvectorlayer.cpp index 4ae0f34d7da..9536bff7a32 100644 --- a/src/core/qgsvectorlayer.cpp +++ b/src/core/qgsvectorlayer.cpp @@ -1561,8 +1561,6 @@ bool QgsVectorLayer::readXml( const QDomNode &layer_node, QgsReadWriteContext &c return false; } - mTemporalProperties->readXml( layer_node.toElement(), context ); - readStyleManager( layer_node ); QDomNode depsNode = layer_node.namedItem( QStringLiteral( "dataDependencies" ) ); @@ -1877,9 +1875,6 @@ bool QgsVectorLayer::writeXml( QDomNode &layer_node, // save expression fields mExpressionFieldBuffer->writeXml( layer_node, document ); - // write temporal properties - mTemporalProperties->writeXml( mapLayerNode, document, context ); - writeStyleManager( layer_node, document ); // auxiliary layer diff --git a/src/core/raster/qgsrasterlayer.cpp b/src/core/raster/qgsrasterlayer.cpp index a19af9787e4..59ca3e10dbf 100644 --- a/src/core/raster/qgsrasterlayer.cpp +++ b/src/core/raster/qgsrasterlayer.cpp @@ -1965,8 +1965,6 @@ bool QgsRasterLayer::readXml( const QDomNode &layer_node, QgsReadWriteContext &c } } - mTemporalProperties->readXml( layer_node.toElement(), context ); - readStyleManager( layer_node ); return res; @@ -2069,9 +2067,6 @@ bool QgsRasterLayer::writeXml( QDomNode &layer_node, layer_node.appendChild( noData ); } - // write temporal properties - mTemporalProperties->writeXml( mapLayerNode, document, context ); - writeStyleManager( layer_node, document ); //write out the symbology diff --git a/src/gui/qgsmaplayerstylecategoriesmodel.cpp b/src/gui/qgsmaplayerstylecategoriesmodel.cpp index ad879398ae5..74e3a4c6fad 100644 --- a/src/gui/qgsmaplayerstylecategoriesmodel.cpp +++ b/src/gui/qgsmaplayerstylecategoriesmodel.cpp @@ -231,6 +231,19 @@ QVariant QgsMapLayerStyleCategoriesModel::data( const QModelIndex &index, int ro return QgsApplication::getThemeIcon( QStringLiteral( "/propertyicons/relations.svg" ) ); } break; + + case QgsMapLayer::StyleCategory::Temporal: + switch ( role ) + { + case Qt::DisplayRole: + return tr( "Temporal Properties" ); + case Qt::ToolTipRole: + return tr( "Temporal properties" ); + case Qt::DecorationRole: + return QgsApplication::getThemeIcon( QStringLiteral( "/propertyicons/temporal.svg" ) ); + } + break; + case QgsMapLayer::StyleCategory::AllStyleCategories: switch ( role ) {