Skip to content

Commit

Permalink
Setting crs for extent group box shouldn't auto check the box
Browse files Browse the repository at this point in the history
Causes e.g. changing the destination CRS in the save vector
file dialog to accidentally enable the "extent" filter option.

Refs #18977
  • Loading branch information
nyalldawson committed May 22, 2018
1 parent 959d1e9 commit 681074b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/gui/qgsextentgroupbox.cpp
Expand Up @@ -78,6 +78,7 @@ void QgsExtentGroupBox::setOutputCrs( const QgsCoordinateReferenceSystem &output
{ {
if ( mOutputCrs != outputCrs ) if ( mOutputCrs != outputCrs )
{ {
bool prevExtentEnabled = isChecked();
switch ( mExtentState ) switch ( mExtentState )
{ {
case CurrentExtent: case CurrentExtent:
Expand Down Expand Up @@ -116,6 +117,8 @@ void QgsExtentGroupBox::setOutputCrs( const QgsCoordinateReferenceSystem &output
break; break;
} }


if ( !prevExtentEnabled )
setChecked( false );
} }


} }
Expand Down
9 changes: 9 additions & 0 deletions tests/src/python/test_qgsextentgroupbox.py
Expand Up @@ -86,6 +86,15 @@ def test_SettingExtent(self):


def testSetOutputCrs(self): def testSetOutputCrs(self):
w = qgis.gui.QgsExtentGroupBox() w = qgis.gui.QgsExtentGroupBox()
w.setCheckable(True)

# ensure setting output crs doesn't change state of group box
w.setChecked(False)
w.setOutputCrs(QgsCoordinateReferenceSystem('epsg:4326'))
self.assertFalse(w.isChecked())
w.setChecked(True)
w.setOutputCrs(QgsCoordinateReferenceSystem('epsg:4326'))
self.assertTrue(w.isChecked())


w.setOutputCrs(QgsCoordinateReferenceSystem('epsg:4326')) w.setOutputCrs(QgsCoordinateReferenceSystem('epsg:4326'))
w.setCurrentExtent(QgsRectangle(1, 2, 3, 4), QgsCoordinateReferenceSystem('epsg:4326')) w.setCurrentExtent(QgsRectangle(1, 2, 3, 4), QgsCoordinateReferenceSystem('epsg:4326'))
Expand Down

0 comments on commit 681074b

Please sign in to comment.