Skip to content

Commit

Permalink
Remove duplicate selectionChanged signal from QgsVectorLayer
Browse files Browse the repository at this point in the history
If you don't want the extra info, just don't capture it...
  • Loading branch information
nyalldawson committed Nov 14, 2016
1 parent d3f5314 commit 4a5faa0
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 32 deletions.
2 changes: 1 addition & 1 deletion doc/api_break.dox
Expand Up @@ -1504,7 +1504,7 @@ displayExpression instead. For the map tip use mapTipTemplate() instead.
- saveStyleToDatabase(): msgError argument is correctly declared as output argument
- getStyleFromDatabase(): msgError argument is correctly declared as output argument
- loadNamedStyle(): theResultFlag argument is correctly declared as output argument

- The duplicate selectionChanged() signal was removed. Use selectionChanged( const QgsFeatureIds&, const QgsFeatureIds&, const bool ) instead.

QgsVectorLayerEditBuffer {#qgis_api_break_3_0_QgsVectorLayerEditBuffer}
------------------------
Expand Down
3 changes: 0 additions & 3 deletions python/core/qgsvectorlayer.sip
Expand Up @@ -1548,9 +1548,6 @@ class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator
*/
void selectionChanged( const QgsFeatureIds& selected, const QgsFeatureIds& deselected, const bool clearAndSelect );

/** This signal is emitted when selection was changed */
void selectionChanged();

/** This signal is emitted when modifications has been done on layer */
void layerModified();

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsattributetabledialog.cpp
Expand Up @@ -181,7 +181,7 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid
connect( mLayer, SIGNAL( editingStarted() ), this, SLOT( editingToggled() ) );
connect( mLayer, SIGNAL( editingStopped() ), this, SLOT( editingToggled() ) );
connect( mLayer, SIGNAL( destroyed() ), this, SLOT( close() ) );
connect( mLayer, SIGNAL( selectionChanged() ), this, SLOT( updateTitle() ) );
connect( mLayer, &QgsVectorLayer::selectionChanged, this, &QgsAttributeTableDialog::updateTitle );
connect( mLayer, SIGNAL( featureAdded( QgsFeatureId ) ), this, SLOT( updateTitle() ) );
connect( mLayer, SIGNAL( featuresDeleted( QgsFeatureIds ) ), this, SLOT( updateTitle() ) );
connect( mLayer, SIGNAL( attributeAdded( int ) ), this, SLOT( columnBoxInit() ) );
Expand Down
6 changes: 3 additions & 3 deletions src/app/qgsstatisticalsummarydockwidget.cpp
Expand Up @@ -251,14 +251,14 @@ void QgsStatisticalSummaryDockWidget::layerChanged( QgsMapLayer *layer )
QgsVectorLayer* newLayer = dynamic_cast< QgsVectorLayer* >( layer );
if ( mLayer && mLayer != newLayer )
{
disconnect( mLayer, SIGNAL( selectionChanged() ), this, SLOT( layerSelectionChanged() ) );
disconnect( mLayer, &QgsVectorLayer::selectionChanged, this, &QgsStatisticalSummaryDockWidget::layerSelectionChanged );
}

mLayer = newLayer;

if ( mLayer )
{
connect( mLayer, SIGNAL( selectionChanged() ), this, SLOT( layerSelectionChanged() ) );
connect( mLayer, &QgsVectorLayer::selectionChanged, this, &QgsStatisticalSummaryDockWidget::layerSelectionChanged );
}

mFieldExpressionWidget->setLayer( mLayer );
Expand Down Expand Up @@ -294,7 +294,7 @@ void QgsStatisticalSummaryDockWidget::layersRemoved( const QStringList& layers )
{
if ( mLayer && layers.contains( mLayer->id() ) )
{
disconnect( mLayer, SIGNAL( selectionChanged() ), this, SLOT( layerSelectionChanged() ) );
disconnect( mLayer, &QgsVectorLayer::selectionChanged, this, &QgsStatisticalSummaryDockWidget::layerSelectionChanged );
mLayer = nullptr;
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/core/qgsvectorlayer.cpp
Expand Up @@ -155,8 +155,7 @@ QgsVectorLayer::QgsVectorLayer( const QString& vectorLayerPath,
setDataSource( vectorLayerPath, baseName, providerKey, loadDefaultStyleFlag );
}

connect( this, SIGNAL( selectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ), this, SIGNAL( selectionChanged() ) );
connect( this, SIGNAL( selectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ), this, SIGNAL( repaintRequested() ) );
connect( this, &QgsVectorLayer::selectionChanged, this, &QgsVectorLayer::repaintRequested );
connect( QgsProject::instance()->relationManager(), &QgsRelationManager::relationsLoaded, this, &QgsVectorLayer::onRelationsLoaded );

// Default simplify drawing settings
Expand Down
3 changes: 0 additions & 3 deletions src/core/qgsvectorlayer.h
Expand Up @@ -1691,9 +1691,6 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
*/
void selectionChanged( const QgsFeatureIds& selected, const QgsFeatureIds& deselected, const bool clearAndSelect );

//! This signal is emitted when selection was changed
void selectionChanged();

//! This signal is emitted when modifications has been done on layer
void layerModified();

Expand Down
2 changes: 1 addition & 1 deletion src/gui/attributetable/qgsattributetablefiltermodel.cpp
Expand Up @@ -38,7 +38,7 @@ QgsAttributeTableFilterModel::QgsAttributeTableFilterModel( QgsMapCanvas* canvas
setSourceModel( sourceModel );
setDynamicSortFilter( true );
setSortRole( QgsAttributeTableModel::SortRole );
connect( layer(), SIGNAL( selectionChanged() ), SLOT( selectionChanged() ) );
connect( layer(), &QgsVectorLayer::selectionChanged, this, &QgsAttributeTableFilterModel::selectionChanged );
}

bool QgsAttributeTableFilterModel::lessThan( const QModelIndex &left, const QModelIndex &right ) const
Expand Down
2 changes: 1 addition & 1 deletion src/gui/attributetable/qgsvectorlayerselectionmanager.cpp
Expand Up @@ -21,7 +21,7 @@ QgsVectorLayerSelectionManager::QgsVectorLayerSelectionManager( QgsVectorLayer*
: QgsIFeatureSelectionManager( parent )
, mLayer( layer )
{
connect( mLayer, SIGNAL( selectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ), this, SIGNAL( selectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ) );
connect( mLayer, &QgsVectorLayer::selectionChanged, this, &QgsVectorLayerSelectionManager::selectionChanged );
}

int QgsVectorLayerSelectionManager::selectedFeatureCount()
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsattributeform.cpp
Expand Up @@ -78,7 +78,7 @@ QgsAttributeForm::QgsAttributeForm( QgsVectorLayer* vl, const QgsFeature &featur
connect( vl, &QgsVectorLayer::updatedFields, this, &QgsAttributeForm::onUpdatedFields );
connect( vl, &QgsVectorLayer::beforeAddingExpressionField, this, &QgsAttributeForm::preventFeatureRefresh );
connect( vl, &QgsVectorLayer::beforeRemovingExpressionField, this, &QgsAttributeForm::preventFeatureRefresh );
connect( vl, SIGNAL( selectionChanged() ), this, SLOT( layerSelectionChanged() ) );
connect( vl, &QgsVectorLayer::selectionChanged, this, &QgsAttributeForm::layerSelectionChanged );

// constraints management
updateAllConstraints();
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsmapcanvas.cpp
Expand Up @@ -336,7 +336,7 @@ void QgsMapCanvas::setLayerSet( QList<QgsMapCanvasLayer> &layers )
QgsVectorLayer *isVectLyr = qobject_cast<QgsVectorLayer *>( currentLayer );
if ( isVectLyr )
{
disconnect( currentLayer, SIGNAL( selectionChanged() ), this, SLOT( selectionChangedSlot() ) );
disconnect( isVectLyr, &QgsVectorLayer::selectionChanged, this, &QgsMapCanvas::selectionChangedSlot );
}
}

Expand All @@ -354,7 +354,7 @@ void QgsMapCanvas::setLayerSet( QList<QgsMapCanvasLayer> &layers )
QgsVectorLayer *isVectLyr = qobject_cast<QgsVectorLayer *>( currentLayer );
if ( isVectLyr )
{
connect( currentLayer, SIGNAL( selectionChanged() ), this, SLOT( selectionChangedSlot() ) );
connect( isVectLyr, &QgsVectorLayer::selectionChanged, this, &QgsMapCanvas::selectionChangedSlot );
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/plugins/grass/qgsgrassmoduleparam.cpp
Expand Up @@ -1388,8 +1388,7 @@ void QgsGrassModuleSelection::onModeChanged()
if ( vectorLayer )
{
onLayerSelectionChanged();
connect( vectorLayer, SIGNAL( selectionChanged( const QgsFeatureIds, const QgsFeatureIds, const bool ) ),
SLOT( onLayerSelectionChanged() ) );
connect( vectorLayer, &QgsVectorLayer::selectionChanged, this, &QgsGrassModuleSelection::onLayerSelectionChanged );
}
}
}
Expand Down
24 changes: 12 additions & 12 deletions src/plugins/spatialquery/qgsspatialquerydialog.cpp
Expand Up @@ -125,23 +125,23 @@ void QgsSpatialQueryDialog::setLayer( bool isTarget, int index )
{
if ( mLayerTarget )
{
disconnect( mLayerTarget, SIGNAL( selectionChanged() ),
this, SLOT( signal_layerTarget_selectionFeaturesChanged() ) );
disconnect( mLayerTarget, &QgsVectorLayer::selectionChanged,
this, &QgsSpatialQueryDialog::signal_layerTarget_selectionFeaturesChanged );
}
mLayerTarget = getLayerFromCombobox( isTarget, index );
connect( mLayerTarget, SIGNAL( selectionChanged() ),
this, SLOT( signal_layerTarget_selectionFeaturesChanged() ) );
connect( mLayerTarget, &QgsVectorLayer::selectionChanged,
this, &QgsSpatialQueryDialog::signal_layerTarget_selectionFeaturesChanged );
}
else
{
if ( mLayerReference )
{
disconnect( mLayerReference, SIGNAL( selectionChanged() ),
this, SLOT( signal_layerReference_selectionFeaturesChanged() ) );
disconnect( mLayerReference, &QgsVectorLayer::selectionChanged,
this, &QgsSpatialQueryDialog::signal_layerReference_selectionFeaturesChanged );
}
mLayerReference = getLayerFromCombobox( isTarget, index );
connect( mLayerReference, SIGNAL( selectionChanged() ),
this, SLOT( signal_layerReference_selectionFeaturesChanged() ) );
connect( mLayerReference, &QgsVectorLayer::selectionChanged,
this, &QgsSpatialQueryDialog::signal_layerReference_selectionFeaturesChanged );
}
} // void QgsSpatialQueryDialog::setLayer(bool isTarget, int index)

Expand Down Expand Up @@ -369,14 +369,14 @@ void QgsSpatialQueryDialog::disconnectAll()

if ( mLayerTarget )
{
disconnect( mLayerTarget, SIGNAL( selectionChanged() ),
this, SLOT( signal_layerTarget_selectionFeaturesChanged() ) );
disconnect( mLayerTarget, &QgsVectorLayer::selectionChanged,
this, &QgsSpatialQueryDialog::signal_layerTarget_selectionFeaturesChanged );

}
if ( mLayerReference )
{
disconnect( mLayerReference, SIGNAL( selectionChanged() ),
this, SLOT( signal_layerReference_selectionFeaturesChanged() ) );
disconnect( mLayerReference, &QgsVectorLayer::selectionChanged,
this, &QgsSpatialQueryDialog::signal_layerReference_selectionFeaturesChanged );
}
} // QgsSpatialQueryDialog::disconnectAll()

Expand Down

0 comments on commit 4a5faa0

Please sign in to comment.