Skip to content

Commit bf18f15

Browse files
committed
Improve confusing error message, fix incorrect widget state restoration
1 parent e8b2913 commit bf18f15

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/plugins/geometry_checker/qgsgeometrycheckersetuptab.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ void QgsGeometryCheckerSetupTab::runChecks()
255255
QgsVectorLayer *followBoundaryCheckLayer = ui.comboBoxFollowBoundaries->isEnabled() ? dynamic_cast<QgsVectorLayer *>( QgsProject::instance()->mapLayer( ui.comboBoxFollowBoundaries->currentData().toString() ) ) : nullptr;
256256
if ( layers.contains( lineLayerCheckLayer ) || layers.contains( followBoundaryCheckLayer ) )
257257
{
258-
QMessageBox::critical( this, tr( "Check Geometries" ), tr( "The test layer set contains a layer selected for a topology check." ) );
258+
QMessageBox::critical( this, tr( "Check Geometries" ), tr( "The selected input layers cannot contain a layer also selected for a topology check." ) );
259259
return;
260260
}
261261

src/plugins/geometry_checker/qgsgeometrycheckfactory.cpp

+12-6
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,12 @@ template<> void QgsGeometryCheckFactoryT<QgsGeometryFollowBoundariesCheck>::rest
254254

255255
template<> bool QgsGeometryCheckFactoryT<QgsGeometryFollowBoundariesCheck>::checkApplicability( Ui::QgsGeometryCheckerSetupTab &ui, int /*nPoint*/, int nLineString, int nPolygon ) const
256256
{
257-
ui.checkBoxFollowBoundaries->setEnabled( nLineString + nPolygon > 0 );
258-
ui.checkBoxFollowBoundaries->setEnabled( nLineString + nPolygon > 0 );
259-
return ui.checkBoxFollowBoundaries->isEnabled();
257+
const bool enabled = nPolygon > 0;
258+
if ( !enabled )
259+
ui.checkBoxFollowBoundaries->setChecked( false );
260+
ui.checkBoxFollowBoundaries->setEnabled( enabled );
261+
ui.comboBoxFollowBoundaries->setEnabled( enabled && ui.checkBoxFollowBoundaries->isChecked() );
262+
return enabled;
260263
}
261264

262265
template<> QgsGeometryCheck *QgsGeometryCheckFactoryT<QgsGeometryFollowBoundariesCheck>::createInstance( QgsGeometryCheckerContext *context, const Ui::QgsGeometryCheckerSetupTab &ui ) const
@@ -371,9 +374,12 @@ template<> void QgsGeometryCheckFactoryT<QgsGeometryLineLayerIntersectionCheck>:
371374

372375
template<> bool QgsGeometryCheckFactoryT<QgsGeometryLineLayerIntersectionCheck>::checkApplicability( Ui::QgsGeometryCheckerSetupTab &ui, int /*nPoint*/, int nLineString, int /*nPolygon*/ ) const
373376
{
374-
ui.checkLineLayerIntersection->setEnabled( nLineString > 0 );
375-
ui.comboLineLayerIntersection->setEnabled( nLineString > 0 );
376-
return ui.checkLineLayerIntersection->isEnabled();
377+
const bool enabled = nLineString > 0;
378+
if ( !enabled )
379+
ui.checkLineLayerIntersection->setChecked( false );
380+
ui.checkLineLayerIntersection->setEnabled( enabled );
381+
ui.comboLineLayerIntersection->setEnabled( enabled && ui.checkLineLayerIntersection->isChecked() );
382+
return enabled;
377383
}
378384

379385
template<> QgsGeometryCheck *QgsGeometryCheckFactoryT<QgsGeometryLineLayerIntersectionCheck>::createInstance( QgsGeometryCheckerContext *context, const Ui::QgsGeometryCheckerSetupTab &ui ) const

0 commit comments

Comments
 (0)