Skip to content

Commit

Permalink
Don't prompt for CRS for annotation layers
Browse files Browse the repository at this point in the history
Fixes #38739
  • Loading branch information
nyalldawson committed Sep 16, 2020
1 parent 49037e0 commit 15975c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/core/annotations/qgsannotationlayer.cpp
Expand Up @@ -26,6 +26,7 @@ QgsAnnotationLayer::QgsAnnotationLayer( const QString &name, const LayerOptions
: QgsMapLayer( QgsMapLayerType::AnnotationLayer, name )
, mTransformContext( options.transformContext )
{
mShouldValidateCrs = false;
mValid = true;
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsmaplayer.cpp
Expand Up @@ -257,7 +257,7 @@ bool QgsMapLayer::readLayerXml( const QDomElement &layerElement, QgsReadWriteCon
QDomNode srsNode = layerElement.namedItem( QStringLiteral( "srs" ) );
mCRS.readXml( srsNode );
mCRS.setValidationHint( tr( "Specify CRS for layer %1" ).arg( mne.text() ) );
if ( isSpatial() )
if ( isSpatial() && type() != QgsMapLayerType::AnnotationLayer )
mCRS.validate();
savedCRS = mCRS;

Expand Down Expand Up @@ -770,7 +770,7 @@ void QgsMapLayer::setCrs( const QgsCoordinateReferenceSystem &srs, bool emitSign
{
mCRS = srs;

if ( mShouldValidateCrs && isSpatial() && !mCRS.isValid() )
if ( mShouldValidateCrs && isSpatial() && !mCRS.isValid() && type() != QgsMapLayerType::AnnotationLayer )
{
mCRS.setValidationHint( tr( "Specify CRS for layer %1" ).arg( name() ) );
mCRS.validate();
Expand Down

0 comments on commit 15975c1

Please sign in to comment.