Skip to content

Commit

Permalink
remember and revert crs change
Browse files Browse the repository at this point in the history
  • Loading branch information
roya0045 authored and nyalldawson committed Dec 23, 2021
1 parent 5ac07f5 commit 143fd16
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/gui/vector/qgsvectorlayerproperties.cpp
Expand Up @@ -300,6 +300,7 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
}
}


mCrsSelector->setCrs( mLayer->crs() );

//insert existing join info
Expand Down Expand Up @@ -557,7 +558,7 @@ void QgsVectorLayerProperties::syncToLayer()

// populate the general information
mLayerOrigNameLineEdit->setText( mLayer->name() );

mBackupCrs = mLayer->crs();
//see if we are dealing with a pg layer here
mSubsetGroupBox->setEnabled( true );
txtSubsetSQL->setText( mLayer->subsetString() );
Expand Down Expand Up @@ -691,7 +692,7 @@ void QgsVectorLayerProperties::apply()
{
labelingDialog->writeSettingsToLayer();
}

mBackupCrs = mLayer->crs();
// apply legend settings
mLegendWidget->applyToLayer();
mLegendConfigEmbeddedWidget->applyToLayer();
Expand Down Expand Up @@ -917,6 +918,9 @@ void QgsVectorLayerProperties::onCancel()
doc.setContent( mOldStyle.xmlData(), false, &myMessage, &errorLine, &errorColumn );
mLayer->importNamedStyle( doc, myMessage );
}

if ( mBackupCrs != mLayer->crs() )
mLayer->setCrs( mBackupCrs );
}

void QgsVectorLayerProperties::urlClicked( const QUrl &url )
Expand Down Expand Up @@ -979,6 +983,7 @@ QString QgsVectorLayerProperties::htmlMetadata()

void QgsVectorLayerProperties::mCrsSelector_crsChanged( const QgsCoordinateReferenceSystem &crs )
{

QgsDatumTransformDialog::run( crs, QgsProject::instance()->crs(), this, mCanvas, tr( "Select Transformation for the vector layer" ) );
mLayer->setCrs( crs );
mMetadataFilled = false;
Expand Down
2 changes: 2 additions & 0 deletions src/gui/vector/qgsvectorlayerproperties.h
Expand Up @@ -251,6 +251,8 @@ class GUI_EXPORT QgsVectorLayerProperties : public QgsOptionsDialogBase, private
QgsVectorLayerTemporalPropertiesWidget *mTemporalWidget = nullptr;

QgsProviderSourceWidget *mSourceWidget = nullptr;

QgsCoordinateReferenceSystem mBackupCrs;

private slots:
void openPanel( QgsPanelWidget *panel );
Expand Down

0 comments on commit 143fd16

Please sign in to comment.