Skip to content
Permalink
Browse files

Setting crs for extent group box shouldn't auto check the box

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 681074bf25c9f71e427e097c9b08d70937540ff6
Showing with 12 additions and 0 deletions.
  1. +3 −0 src/gui/qgsextentgroupbox.cpp
  2. +9 −0 tests/src/python/test_qgsextentgroupbox.py
@@ -78,6 +78,7 @@ void QgsExtentGroupBox::setOutputCrs( const QgsCoordinateReferenceSystem &output
{
if ( mOutputCrs != outputCrs )
{
bool prevExtentEnabled = isChecked();
switch ( mExtentState )
{
case CurrentExtent:
@@ -116,6 +117,8 @@ void QgsExtentGroupBox::setOutputCrs( const QgsCoordinateReferenceSystem &output
break;
}

if ( !prevExtentEnabled )
setChecked( false );
}

}
@@ -86,6 +86,15 @@ def test_SettingExtent(self):

def testSetOutputCrs(self):
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.setCurrentExtent(QgsRectangle(1, 2, 3, 4), QgsCoordinateReferenceSystem('epsg:4326'))

0 comments on commit 681074b

Please sign in to comment.
You can’t perform that action at this time.