Skip to content

Commit 4a5faa0

Browse files
committed
Remove duplicate selectionChanged signal from QgsVectorLayer
If you don't want the extra info, just don't capture it...
1 parent d3f5314 commit 4a5faa0

12 files changed

+24
-32
lines changed

doc/api_break.dox

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,7 @@ displayExpression instead. For the map tip use mapTipTemplate() instead.
15041504
- saveStyleToDatabase(): msgError argument is correctly declared as output argument
15051505
- getStyleFromDatabase(): msgError argument is correctly declared as output argument
15061506
- loadNamedStyle(): theResultFlag argument is correctly declared as output argument
1507-
1507+
- The duplicate selectionChanged() signal was removed. Use selectionChanged( const QgsFeatureIds&, const QgsFeatureIds&, const bool ) instead.
15081508

15091509
QgsVectorLayerEditBuffer {#qgis_api_break_3_0_QgsVectorLayerEditBuffer}
15101510
------------------------

python/core/qgsvectorlayer.sip

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,9 +1548,6 @@ class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator
15481548
*/
15491549
void selectionChanged( const QgsFeatureIds& selected, const QgsFeatureIds& deselected, const bool clearAndSelect );
15501550

1551-
/** This signal is emitted when selection was changed */
1552-
void selectionChanged();
1553-
15541551
/** This signal is emitted when modifications has been done on layer */
15551552
void layerModified();
15561553

src/app/qgsattributetabledialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid
181181
connect( mLayer, SIGNAL( editingStarted() ), this, SLOT( editingToggled() ) );
182182
connect( mLayer, SIGNAL( editingStopped() ), this, SLOT( editingToggled() ) );
183183
connect( mLayer, SIGNAL( destroyed() ), this, SLOT( close() ) );
184-
connect( mLayer, SIGNAL( selectionChanged() ), this, SLOT( updateTitle() ) );
184+
connect( mLayer, &QgsVectorLayer::selectionChanged, this, &QgsAttributeTableDialog::updateTitle );
185185
connect( mLayer, SIGNAL( featureAdded( QgsFeatureId ) ), this, SLOT( updateTitle() ) );
186186
connect( mLayer, SIGNAL( featuresDeleted( QgsFeatureIds ) ), this, SLOT( updateTitle() ) );
187187
connect( mLayer, SIGNAL( attributeAdded( int ) ), this, SLOT( columnBoxInit() ) );

src/app/qgsstatisticalsummarydockwidget.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,14 +251,14 @@ void QgsStatisticalSummaryDockWidget::layerChanged( QgsMapLayer *layer )
251251
QgsVectorLayer* newLayer = dynamic_cast< QgsVectorLayer* >( layer );
252252
if ( mLayer && mLayer != newLayer )
253253
{
254-
disconnect( mLayer, SIGNAL( selectionChanged() ), this, SLOT( layerSelectionChanged() ) );
254+
disconnect( mLayer, &QgsVectorLayer::selectionChanged, this, &QgsStatisticalSummaryDockWidget::layerSelectionChanged );
255255
}
256256

257257
mLayer = newLayer;
258258

259259
if ( mLayer )
260260
{
261-
connect( mLayer, SIGNAL( selectionChanged() ), this, SLOT( layerSelectionChanged() ) );
261+
connect( mLayer, &QgsVectorLayer::selectionChanged, this, &QgsStatisticalSummaryDockWidget::layerSelectionChanged );
262262
}
263263

264264
mFieldExpressionWidget->setLayer( mLayer );
@@ -294,7 +294,7 @@ void QgsStatisticalSummaryDockWidget::layersRemoved( const QStringList& layers )
294294
{
295295
if ( mLayer && layers.contains( mLayer->id() ) )
296296
{
297-
disconnect( mLayer, SIGNAL( selectionChanged() ), this, SLOT( layerSelectionChanged() ) );
297+
disconnect( mLayer, &QgsVectorLayer::selectionChanged, this, &QgsStatisticalSummaryDockWidget::layerSelectionChanged );
298298
mLayer = nullptr;
299299
}
300300
}

src/core/qgsvectorlayer.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ QgsVectorLayer::QgsVectorLayer( const QString& vectorLayerPath,
155155
setDataSource( vectorLayerPath, baseName, providerKey, loadDefaultStyleFlag );
156156
}
157157

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

162161
// Default simplify drawing settings

src/core/qgsvectorlayer.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,9 +1691,6 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
16911691
*/
16921692
void selectionChanged( const QgsFeatureIds& selected, const QgsFeatureIds& deselected, const bool clearAndSelect );
16931693

1694-
//! This signal is emitted when selection was changed
1695-
void selectionChanged();
1696-
16971694
//! This signal is emitted when modifications has been done on layer
16981695
void layerModified();
16991696

src/gui/attributetable/qgsattributetablefiltermodel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ QgsAttributeTableFilterModel::QgsAttributeTableFilterModel( QgsMapCanvas* canvas
3838
setSourceModel( sourceModel );
3939
setDynamicSortFilter( true );
4040
setSortRole( QgsAttributeTableModel::SortRole );
41-
connect( layer(), SIGNAL( selectionChanged() ), SLOT( selectionChanged() ) );
41+
connect( layer(), &QgsVectorLayer::selectionChanged, this, &QgsAttributeTableFilterModel::selectionChanged );
4242
}
4343

4444
bool QgsAttributeTableFilterModel::lessThan( const QModelIndex &left, const QModelIndex &right ) const

src/gui/attributetable/qgsvectorlayerselectionmanager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ QgsVectorLayerSelectionManager::QgsVectorLayerSelectionManager( QgsVectorLayer*
2121
: QgsIFeatureSelectionManager( parent )
2222
, mLayer( layer )
2323
{
24-
connect( mLayer, SIGNAL( selectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ), this, SIGNAL( selectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ) );
24+
connect( mLayer, &QgsVectorLayer::selectionChanged, this, &QgsVectorLayerSelectionManager::selectionChanged );
2525
}
2626

2727
int QgsVectorLayerSelectionManager::selectedFeatureCount()

src/gui/qgsattributeform.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ QgsAttributeForm::QgsAttributeForm( QgsVectorLayer* vl, const QgsFeature &featur
7878
connect( vl, &QgsVectorLayer::updatedFields, this, &QgsAttributeForm::onUpdatedFields );
7979
connect( vl, &QgsVectorLayer::beforeAddingExpressionField, this, &QgsAttributeForm::preventFeatureRefresh );
8080
connect( vl, &QgsVectorLayer::beforeRemovingExpressionField, this, &QgsAttributeForm::preventFeatureRefresh );
81-
connect( vl, SIGNAL( selectionChanged() ), this, SLOT( layerSelectionChanged() ) );
81+
connect( vl, &QgsVectorLayer::selectionChanged, this, &QgsAttributeForm::layerSelectionChanged );
8282

8383
// constraints management
8484
updateAllConstraints();

src/gui/qgsmapcanvas.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ void QgsMapCanvas::setLayerSet( QList<QgsMapCanvasLayer> &layers )
336336
QgsVectorLayer *isVectLyr = qobject_cast<QgsVectorLayer *>( currentLayer );
337337
if ( isVectLyr )
338338
{
339-
disconnect( currentLayer, SIGNAL( selectionChanged() ), this, SLOT( selectionChangedSlot() ) );
339+
disconnect( isVectLyr, &QgsVectorLayer::selectionChanged, this, &QgsMapCanvas::selectionChangedSlot );
340340
}
341341
}
342342

@@ -354,7 +354,7 @@ void QgsMapCanvas::setLayerSet( QList<QgsMapCanvasLayer> &layers )
354354
QgsVectorLayer *isVectLyr = qobject_cast<QgsVectorLayer *>( currentLayer );
355355
if ( isVectLyr )
356356
{
357-
connect( currentLayer, SIGNAL( selectionChanged() ), this, SLOT( selectionChangedSlot() ) );
357+
connect( isVectLyr, &QgsVectorLayer::selectionChanged, this, &QgsMapCanvas::selectionChangedSlot );
358358
}
359359
}
360360

0 commit comments

Comments
 (0)