Skip to content

Commit 681074b

Browse files
committed
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
1 parent 959d1e9 commit 681074b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/gui/qgsextentgroupbox.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ void QgsExtentGroupBox::setOutputCrs( const QgsCoordinateReferenceSystem &output
7878
{
7979
if ( mOutputCrs != outputCrs )
8080
{
81+
bool prevExtentEnabled = isChecked();
8182
switch ( mExtentState )
8283
{
8384
case CurrentExtent:
@@ -116,6 +117,8 @@ void QgsExtentGroupBox::setOutputCrs( const QgsCoordinateReferenceSystem &output
116117
break;
117118
}
118119

120+
if ( !prevExtentEnabled )
121+
setChecked( false );
119122
}
120123

121124
}

tests/src/python/test_qgsextentgroupbox.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ def test_SettingExtent(self):
8686

8787
def testSetOutputCrs(self):
8888
w = qgis.gui.QgsExtentGroupBox()
89+
w.setCheckable(True)
90+
91+
# ensure setting output crs doesn't change state of group box
92+
w.setChecked(False)
93+
w.setOutputCrs(QgsCoordinateReferenceSystem('epsg:4326'))
94+
self.assertFalse(w.isChecked())
95+
w.setChecked(True)
96+
w.setOutputCrs(QgsCoordinateReferenceSystem('epsg:4326'))
97+
self.assertTrue(w.isChecked())
8998

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

0 commit comments

Comments
 (0)