Skip to content
Permalink
Browse files

Remove unneeded code

  • Loading branch information
m-kuhn committed Mar 18, 2019
1 parent 5f4308c commit 6bcba4247a8aff0b24775c4010f3d3a87508bacd
Showing with 0 additions and 25 deletions.
  1. +0 −24 src/app/qgsgeometryvalidationdock.cpp
  2. +0 −1 src/app/qgsgeometryvalidationdock.h
@@ -265,39 +265,15 @@ void QgsGeometryValidationDock::onCurrentLayerChanged( QgsMapLayer *layer )

if ( mCurrentLayer )
{
disconnect( mCurrentLayer, &QgsVectorLayer::editingStarted, this, &QgsGeometryValidationDock::onLayerEditingStatusChanged );
disconnect( mCurrentLayer, &QgsVectorLayer::editingStopped, this, &QgsGeometryValidationDock::onLayerEditingStatusChanged );
disconnect( mCurrentLayer, &QgsVectorLayer::destroyed, this, &QgsGeometryValidationDock::onLayerDestroyed );
}

mCurrentLayer = qobject_cast<QgsVectorLayer *>( layer );

if ( mCurrentLayer )
{
connect( mCurrentLayer, &QgsVectorLayer::editingStarted, this, &QgsGeometryValidationDock::onLayerEditingStatusChanged );
connect( mCurrentLayer, &QgsVectorLayer::editingStopped, this, &QgsGeometryValidationDock::onLayerEditingStatusChanged );
connect( mCurrentLayer, &QgsVectorLayer::destroyed, this, &QgsGeometryValidationDock::onLayerDestroyed );
}

onLayerEditingStatusChanged();
}

void QgsGeometryValidationDock::onLayerEditingStatusChanged()
{
bool enabled = false;
if ( mCurrentLayer && mCurrentLayer->isSpatial() && mCurrentLayer->isEditable() )
{
const QList<QgsGeometryCheckFactory *> topologyCheckFactories = QgsAnalysis::instance()->geometryCheckRegistry()->geometryCheckFactories( mCurrentLayer, QgsGeometryCheck::LayerCheck, QgsGeometryCheck::Flag::AvailableInValidation );
const QStringList activeChecks = mCurrentLayer->geometryOptions()->geometryChecks();
for ( const QgsGeometryCheckFactory *factory : topologyCheckFactories )
{
if ( activeChecks.contains( factory->id() ) )
{
enabled = true;
break;
}
}
}
}

void QgsGeometryValidationDock::onLayerDestroyed( QObject *layer )
@@ -47,7 +47,6 @@ class QgsGeometryValidationDock : public QgsDockWidget, public Ui_QgsGeometryVal
void updateCurrentError();
void onCurrentErrorChanged( const QModelIndex &current, const QModelIndex &previous );
void onCurrentLayerChanged( QgsMapLayer *layer );
void onLayerEditingStatusChanged();
void onLayerDestroyed( QObject *layer );
void gotoNextError();
void gotoPreviousError();

0 comments on commit 6bcba42

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