Skip to content

Commit

Permalink
Don't save removed layers
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 8, 2022
1 parent ce6cf4a commit 25a69f2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/core/project/qgsprojectgpssettings.cpp
Expand Up @@ -110,8 +110,16 @@ QDomElement QgsProjectGpsSettings::writeXml( QDomDocument &doc, const QgsReadWri
QDomElement timeStampElement = doc.createElement( QStringLiteral( "timeStampFields" ) );
for ( auto it = mDestinationTimestampFields.constBegin(); it != mDestinationTimestampFields.constEnd(); ++it )
{
const QString layerId = it.key();
if ( QgsProject *project = qobject_cast< QgsProject * >( parent() ) )
{
// do some housekeeping and don't save removed layers in the project
if ( !project->mapLayer( layerId ) )
continue;
}

QDomElement layerElement = doc.createElement( QStringLiteral( "field" ) );
layerElement.setAttribute( QStringLiteral( "destinationLayer" ), it.key() );
layerElement.setAttribute( QStringLiteral( "destinationLayer" ), layerId );
layerElement.setAttribute( QStringLiteral( "field" ), it.value() );
timeStampElement.appendChild( layerElement );
}
Expand Down

0 comments on commit 25a69f2

Please sign in to comment.