@@ -74,6 +74,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
7474 connect ( buttonBox->button ( QDialogButtonBox::Apply ), SIGNAL ( clicked () ), this , SLOT ( apply () ) );
7575 connect ( this , SIGNAL ( accepted () ), this , SLOT ( apply () ) );
7676 connect ( projectionSelector, SIGNAL ( sridSelected ( QString ) ), this , SLOT ( setMapUnitsToCurrentProjection () ) );
77+ connect ( projectionSelector, SIGNAL ( initialized () ), this , SLOT ( projectionSelectorInitialized () ) );
7778
7879 connect ( cmbEllipsoid, SIGNAL ( currentIndexChanged ( int ) ), this , SLOT ( updateEllipsoidUI ( int ) ) );
7980
@@ -123,33 +124,10 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
123124 cbxAbsolutePath->setCurrentIndex ( QgsProject::instance ()->readBoolEntry ( " Paths" , " /Absolute" , true ) ? 0 : 1 );
124125
125126 // populate combo box with ellipsoids
126-
127- QgsDebugMsg ( " Setting upp ellipsoid" );
128-
127+ // selection of the ellipsoid from settings is defferred to a later point, because it would
128+ // be overridden in the meanwhile by the projection selector
129129 populateEllipsoidList ();
130130
131- // Reading ellipsoid from setttings
132- QStringList mySplitEllipsoid = QgsProject::instance ()->readEntry ( " Measure" , " /Ellipsoid" , GEO_NONE ).split ( ' :' );
133-
134- int myIndex = 0 ;
135- for ( int i = 0 ; i < mEllipsoidList .length (); i++ )
136- {
137- if ( mEllipsoidList [ i ].acronym .startsWith ( mySplitEllipsoid[ 0 ] ) )
138- {
139- myIndex = i;
140- break ;
141- }
142- }
143-
144- // Update paramaters if present.
145- if ( mySplitEllipsoid.length () >= 3 )
146- {
147- mEllipsoidList [ myIndex ].semiMajor = mySplitEllipsoid[ 1 ].toDouble ();
148- mEllipsoidList [ myIndex ].semiMinor = mySplitEllipsoid[ 2 ].toDouble ();
149- }
150-
151- updateEllipsoidUI ( myIndex );
152-
153131
154132 int dp = QgsProject::instance ()->readNumEntry ( " PositionPrecision" , " /DecimalPlaces" );
155133 spinBoxDP->setValue ( dp );
@@ -1631,3 +1609,30 @@ void QgsProjectProperties::updateEllipsoidUI( int newIndex )
16311609 }
16321610 cmbEllipsoid->setCurrentIndex ( mEllipsoidIndex ); // Not always necessary
16331611}
1612+
1613+ void QgsProjectProperties::projectionSelectorInitialized ()
1614+ {
1615+ QgsDebugMsg ( " Setting up ellipsoid" );
1616+
1617+ // Reading ellipsoid from setttings
1618+ QStringList mySplitEllipsoid = QgsProject::instance ()->readEntry ( " Measure" , " /Ellipsoid" , GEO_NONE ).split ( ' :' );
1619+
1620+ int myIndex = 0 ;
1621+ for ( int i = 0 ; i < mEllipsoidList .length (); i++ )
1622+ {
1623+ if ( mEllipsoidList [ i ].acronym .startsWith ( mySplitEllipsoid[ 0 ] ) )
1624+ {
1625+ myIndex = i;
1626+ break ;
1627+ }
1628+ }
1629+
1630+ // Update paramaters if present.
1631+ if ( mySplitEllipsoid.length () >= 3 )
1632+ {
1633+ mEllipsoidList [ myIndex ].semiMajor = mySplitEllipsoid[ 1 ].toDouble ();
1634+ mEllipsoidList [ myIndex ].semiMinor = mySplitEllipsoid[ 2 ].toDouble ();
1635+ }
1636+
1637+ updateEllipsoidUI ( myIndex );
1638+ }
0 commit comments