Skip to content

Commit

Permalink
Improve confusing error message, fix incorrect widget state restoration
Browse files Browse the repository at this point in the history
(cherry-picked from bf18f15)
  • Loading branch information
nyalldawson committed Aug 21, 2018
1 parent 68b4bba commit 05c177f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Expand Up @@ -255,7 +255,7 @@ void QgsGeometryCheckerSetupTab::runChecks()
QgsVectorLayer *followBoundaryCheckLayer = ui.comboBoxFollowBoundaries->isEnabled() ? dynamic_cast<QgsVectorLayer *>( QgsProject::instance()->mapLayer( ui.comboBoxFollowBoundaries->currentData().toString() ) ) : nullptr;
if ( layers.contains( lineLayerCheckLayer ) || layers.contains( followBoundaryCheckLayer ) )
{
QMessageBox::critical( this, tr( "Check Geometries" ), tr( "The test layer set contains a layer selected for a topology check." ) );
QMessageBox::critical( this, tr( "Check Geometries" ), tr( "The selected input layers cannot contain a layer also selected for a topology check." ) );
return;
}

Expand Down
18 changes: 12 additions & 6 deletions src/plugins/geometry_checker/qgsgeometrycheckfactory.cpp
Expand Up @@ -254,9 +254,12 @@ template<> void QgsGeometryCheckFactoryT<QgsGeometryFollowBoundariesCheck>::rest

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

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

template<> bool QgsGeometryCheckFactoryT<QgsGeometryLineLayerIntersectionCheck>::checkApplicability( Ui::QgsGeometryCheckerSetupTab &ui, int /*nPoint*/, int nLineString, int /*nPolygon*/ ) const
{
ui.checkLineLayerIntersection->setEnabled( nLineString > 0 );
ui.comboLineLayerIntersection->setEnabled( nLineString > 0 );
return ui.checkLineLayerIntersection->isEnabled();
const bool enabled = nLineString > 0;
if ( !enabled )
ui.checkLineLayerIntersection->setChecked( false );
ui.checkLineLayerIntersection->setEnabled( enabled );
ui.comboLineLayerIntersection->setEnabled( enabled && ui.checkLineLayerIntersection->isChecked() );
return enabled;
}

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

0 comments on commit 05c177f

Please sign in to comment.