Skip to content

Commit

Permalink
Fix duplicate crsChanged signal emitted when loading projects
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 13, 2017
1 parent f2b5a59 commit be8bad8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/core/qgsproject.cpp
Expand Up @@ -909,7 +909,6 @@ bool QgsProject::readProjectFile( const QString &filename )
}
}
mCrs = projectCrs;
emit crsChanged();

QDomNodeList nl = doc->elementsByTagName( QStringLiteral( "autotransaction" ) );
if ( nl.count() )
Expand Down
3 changes: 3 additions & 0 deletions tests/src/core/testqgscoordinatereferencesystem.cpp
Expand Up @@ -27,6 +27,7 @@ Email : sherman at mrcc dot com
#include <proj_api.h>
#include <gdal.h>
#include <cpl_conv.h>
#include <QtTest/QSignalSpy>

class TestQgsCoordinateReferenceSystem: public QObject
{
Expand Down Expand Up @@ -840,9 +841,11 @@ void TestQgsCoordinateReferenceSystem::projectWithCustomCrs()
{
// tests loading a 2.x project with a custom CRS defined
QgsProject p;
QSignalSpy spyCrsChanged( &p, &QgsProject::crsChanged );
QVERIFY( p.read( TEST_DATA_DIR + QStringLiteral( "/projects/custom_crs.qgs" ) ) );
QVERIFY( p.crs().isValid() );
QCOMPARE( p.crs().toProj4(), QStringLiteral( "+proj=ortho +lat_0=42.1 +lon_0=12.8 +x_0=0 +y_0=0 +a=6371000 +b=6371000 +units=m +no_defs" ) );
QCOMPARE( spyCrsChanged.count(), 1 );
}

QGSTEST_MAIN( TestQgsCoordinateReferenceSystem )
Expand Down

0 comments on commit be8bad8

Please sign in to comment.