Skip to content

Commit 5b0e84a

Browse files
committed
Flip some connects to new style
1 parent 361399c commit 5b0e84a

File tree

2 files changed

+36
-35
lines changed

2 files changed

+36
-35
lines changed

src/gui/attributetable/qgsattributetablemodel.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ QgsAttributeTableModel::QgsAttributeTableModel( QgsVectorLayerCache *layerCache,
6060

6161
loadAttributes();
6262

63-
connect( mLayerCache, SIGNAL( attributeValueChanged( QgsFeatureId, int, const QVariant & ) ), this, SLOT( attributeValueChanged( QgsFeatureId, int, const QVariant & ) ) );
64-
connect( layer(), SIGNAL( featuresDeleted( QgsFeatureIds ) ), this, SLOT( featuresDeleted( QgsFeatureIds ) ) );
65-
connect( layer(), SIGNAL( attributeDeleted( int ) ), this, SLOT( attributeDeleted( int ) ) );
66-
connect( layer(), SIGNAL( updatedFields() ), this, SLOT( updatedFields() ) );
67-
connect( layer(), SIGNAL( editCommandEnded() ), this, SLOT( editCommandEnded() ) );
68-
connect( mLayerCache, SIGNAL( featureAdded( QgsFeatureId ) ), this, SLOT( featureAdded( QgsFeatureId ) ) );
69-
connect( mLayerCache, SIGNAL( cachedLayerDeleted() ), this, SLOT( layerDeleted() ) );
63+
connect( mLayerCache, &QgsVectorLayerCache::attributeValueChanged, this, &QgsAttributeTableModel::attributeValueChanged );
64+
connect( layer(), &QgsVectorLayer::featuresDeleted, this, &QgsAttributeTableModel::featuresDeleted );
65+
connect( layer(), &QgsVectorLayer::attributeDeleted, this, &QgsAttributeTableModel::attributeDeleted );
66+
connect( layer(), &QgsVectorLayer::updatedFields, this, &QgsAttributeTableModel::updatedFields );
67+
connect( layer(), &QgsVectorLayer::editCommandEnded, this, &QgsAttributeTableModel::editCommandEnded );
68+
connect( mLayerCache, &QgsVectorLayerCache::featureAdded, this, &QgsAttributeTableModel::featureAdded );
69+
connect( mLayerCache, &QgsVectorLayerCache::cachedLayerDeleted, this, &QgsAttributeTableModel::layerDeleted );
7070
}
7171

7272
bool QgsAttributeTableModel::loadFeatureAtId( QgsFeatureId fid ) const
@@ -430,7 +430,7 @@ void QgsAttributeTableModel::loadLayer()
430430

431431
emit finished();
432432

433-
connect( mLayerCache, SIGNAL( invalidated() ), this, SLOT( loadLayer() ), Qt::UniqueConnection );
433+
connect( mLayerCache, &QgsVectorLayerCache::invalidated, this, &QgsAttributeTableModel::loadLayer, Qt::UniqueConnection );
434434

435435
endResetModel();
436436
}

src/gui/attributetable/qgsdualview.cpp

+28-27
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ QgsDualView::QgsDualView( QWidget *parent )
6363
mActionExpressionPreview->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mIconExpressionPreview.svg" ) ) );
6464

6565
// Connect layer list preview signals
66-
connect( mActionExpressionPreview, SIGNAL( triggered() ), SLOT( previewExpressionBuilder() ) );
67-
connect( mPreviewActionMapper, SIGNAL( mapped( QObject * ) ), SLOT( previewColumnChanged( QObject * ) ) );
68-
connect( mFeatureList, SIGNAL( displayExpressionChanged( QString ) ), this, SLOT( previewExpressionChanged( QString ) ) );
66+
connect( mActionExpressionPreview, &QAction::triggered, this, &QgsDualView::previewExpressionBuilder );
67+
connect( mPreviewActionMapper, static_cast < void ( QSignalMapper::* )( QObject * ) > ( &QSignalMapper::mapped ), this, &QgsDualView::previewColumnChanged );
68+
connect( mFeatureList, &QgsFeatureListView::displayExpressionChanged, this, &QgsDualView::previewExpressionChanged );
6969
}
7070

7171
void QgsDualView::init( QgsVectorLayer *layer, QgsMapCanvas *mapCanvas, const QgsFeatureRequest &request, const QgsAttributeEditorContext &context )
@@ -77,10 +77,10 @@ void QgsDualView::init( QgsVectorLayer *layer, QgsMapCanvas *mapCanvas, const Qg
7777

7878
mEditorContext = context;
7979

80-
connect( mTableView, SIGNAL( willShowContextMenu( QMenu *, QModelIndex ) ), this, SLOT( viewWillShowContextMenu( QMenu *, QModelIndex ) ) );
80+
connect( mTableView, &QgsAttributeTableView::willShowContextMenu, this, &QgsDualView::viewWillShowContextMenu );
8181
mTableView->horizontalHeader()->setContextMenuPolicy( Qt::CustomContextMenu );
82-
connect( mTableView->horizontalHeader(), SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( showViewHeaderMenu( QPoint ) ) );
83-
connect( mTableView, SIGNAL( columnResized( int, int ) ), this, SLOT( tableColumnResized( int, int ) ) );
82+
connect( mTableView->horizontalHeader(), &QHeaderView::customContextMenuRequested, this, &QgsDualView::showViewHeaderMenu );
83+
connect( mTableView, &QgsAttributeTableView::columnResized, this, &QgsDualView::tableColumnResized );
8484

8585
initLayerCache( !request.filterRect().isNull() );
8686
initModels( mapCanvas, request );
@@ -103,11 +103,11 @@ void QgsDualView::init( QgsVectorLayer *layer, QgsMapCanvas *mapCanvas, const Qg
103103
mAttributeEditor->layout()->addWidget( mAttributeForm );
104104
}
105105

106-
connect( mAttributeForm, SIGNAL( attributeChanged( QString, QVariant ) ), this, SLOT( featureFormAttributeChanged() ) );
107-
connect( mAttributeForm, SIGNAL( modeChanged( QgsAttributeForm::Mode ) ), this, SIGNAL( formModeChanged( QgsAttributeForm::Mode ) ) );
108-
connect( mMasterModel, SIGNAL( modelChanged() ), mAttributeForm, SLOT( refreshFeature() ) );
109-
connect( mAttributeForm, SIGNAL( filterExpressionSet( QString, QgsAttributeForm::FilterType ) ), this, SIGNAL( filterExpressionSet( QString, QgsAttributeForm::FilterType ) ) );
110-
connect( mFilterModel, SIGNAL( sortColumnChanged( int, Qt::SortOrder ) ), this, SLOT( onSortColumnChanged() ) );
106+
connect( mAttributeForm, &QgsAttributeForm::attributeChanged, this, &QgsDualView::featureFormAttributeChanged );
107+
connect( mAttributeForm, &QgsAttributeForm::modeChanged, this, &QgsDualView::formModeChanged );
108+
connect( mMasterModel, &QgsAttributeTableModel::modelChanged, mAttributeForm, &QgsAttributeForm::refreshFeature );
109+
connect( mAttributeForm, &QgsAttributeForm::filterExpressionSet, this, &QgsDualView::filterExpressionSet );
110+
connect( mFilterModel, &QgsAttributeTableFilterModel::sortColumnChanged, this, &QgsDualView::onSortColumnChanged );
111111
if ( mFeatureListPreviewButton->defaultAction() )
112112
mFeatureList->setDisplayExpression( mDisplayExpression );
113113
else
@@ -152,7 +152,8 @@ void QgsDualView::columnBoxInit()
152152
// Generate action for the preview popup button of the feature list
153153
QAction *previewAction = new QAction( icon, text, mFeatureListPreviewButton );
154154
mPreviewActionMapper->setMapping( previewAction, previewAction );
155-
connect( previewAction, SIGNAL( triggered() ), mPreviewActionMapper, SLOT( map() ) );
155+
connect( previewAction, &QAction::triggered, this, [previewAction, this]( bool ) { this->mPreviewActionMapper->map( previewAction ); }
156+
);
156157
mPreviewColumnsMenu->addAction( previewAction );
157158

158159
if ( text == defaultField )
@@ -175,7 +176,7 @@ void QgsDualView::columnBoxInit()
175176
}
176177

177178
QAction *sortByPreviewExpression = new QAction( QgsApplication::getThemeIcon( QStringLiteral( "sort.svg" ) ), tr( "Sort by preview expression" ), this );
178-
connect( sortByPreviewExpression, SIGNAL( triggered( bool ) ), this, SLOT( sortByPreviewExpression() ) );
179+
connect( sortByPreviewExpression, &QAction::triggered, this, &QgsDualView::sortByPreviewExpression );
179180
mFeatureListPreviewButton->addAction( sortByPreviewExpression );
180181
}
181182

@@ -209,8 +210,8 @@ void QgsDualView::initLayerCache( bool cacheGeometry )
209210
mLayerCache->setCacheGeometry( cacheGeometry );
210211
if ( 0 == cacheSize || 0 == ( QgsVectorDataProvider::SelectAtId & mLayer->dataProvider()->capabilities() ) )
211212
{
212-
connect( mLayerCache, SIGNAL( progress( int, bool & ) ), this, SLOT( progress( int, bool & ) ) );
213-
connect( mLayerCache, SIGNAL( finished() ), this, SLOT( finished() ) );
213+
connect( mLayerCache, &QgsVectorLayerCache::progress, this, &QgsDualView::progress );
214+
connect( mLayerCache, &QgsVectorLayerCache::finished, this, &QgsDualView::finished );
214215

215216
mLayerCache->setFullCache( true );
216217
}
@@ -227,16 +228,16 @@ void QgsDualView::initModels( QgsMapCanvas *mapCanvas, const QgsFeatureRequest &
227228
mMasterModel->setEditorContext( mEditorContext );
228229
mMasterModel->setExtraColumns( 1 ); // Add one extra column which we can "abuse" as an action column
229230

230-
connect( mMasterModel, SIGNAL( progress( int, bool & ) ), this, SLOT( progress( int, bool & ) ) );
231-
connect( mMasterModel, SIGNAL( finished() ), this, SLOT( finished() ) );
231+
connect( mMasterModel, &QgsAttributeTableModel::progress, this, &QgsDualView::progress );
232+
connect( mMasterModel, &QgsAttributeTableModel::finished, this, &QgsDualView::finished );
232233

233-
connect( mConditionalFormatWidget, SIGNAL( rulesUpdated( QString ) ), mMasterModel, SLOT( fieldConditionalStyleChanged( QString ) ) );
234+
connect( mConditionalFormatWidget, &QgsFieldConditionalFormatWidget::rulesUpdated, mMasterModel, &QgsAttributeTableModel::fieldConditionalStyleChanged );
234235

235236
mMasterModel->loadLayer();
236237

237238
mFilterModel = new QgsAttributeTableFilterModel( mapCanvas, mMasterModel, mMasterModel );
238239

239-
connect( mFeatureList, SIGNAL( displayExpressionChanged( QString ) ), this, SIGNAL( displayExpressionChanged( QString ) ) );
240+
connect( mFeatureList, &QgsFeatureListView::displayExpressionChanged, this, &QgsDualView::displayExpressionChanged );
240241

241242
mFeatureListModel = new QgsFeatureListModel( mFilterModel, mFilterModel );
242243
}
@@ -378,7 +379,7 @@ void QgsDualView::viewWillShowContextMenu( QMenu *menu, const QModelIndex &atInd
378379
QAction *copyContentAction = new QAction( tr( "Copy cell content" ), this );
379380
copyContentAction->setData( QVariant::fromValue<QModelIndex>( sourceIndex ) );
380381
menu->addAction( copyContentAction );
381-
connect( copyContentAction, SIGNAL( triggered() ), this, SLOT( copyCellContent() ) );
382+
connect( copyContentAction, &QAction::triggered, this, &QgsDualView::copyCellContent );
382383

383384
QgsVectorLayer *vl = mFilterModel->layer();
384385
QgsMapCanvas *canvas = mFilterModel->mapCanvas();
@@ -433,24 +434,24 @@ void QgsDualView::showViewHeaderMenu( QPoint point )
433434
mHorizontalHeaderMenu = new QMenu( this );
434435

435436
QAction *hide = new QAction( tr( "&Hide column" ), mHorizontalHeaderMenu );
436-
connect( hide, SIGNAL( triggered( bool ) ), this, SLOT( hideColumn() ) );
437+
connect( hide, &QAction::triggered, this, &QgsDualView::hideColumn );
437438
hide->setData( col );
438439
mHorizontalHeaderMenu->addAction( hide );
439440
QAction *setWidth = new QAction( tr( "&Set width..." ), mHorizontalHeaderMenu );
440-
connect( setWidth, SIGNAL( triggered( bool ) ), this, SLOT( resizeColumn() ) );
441+
connect( setWidth, &QAction::triggered, this, &QgsDualView::resizeColumn );
441442
setWidth->setData( col );
442443
mHorizontalHeaderMenu->addAction( setWidth );
443444
QAction *optimizeWidth = new QAction( tr( "&Autosize" ), mHorizontalHeaderMenu );
444-
connect( optimizeWidth, SIGNAL( triggered( bool ) ), this, SLOT( autosizeColumn() ) );
445+
connect( optimizeWidth, &QAction::triggered, this, &QgsDualView::autosizeColumn );
445446
optimizeWidth->setData( col );
446447
mHorizontalHeaderMenu->addAction( optimizeWidth );
447448

448449
mHorizontalHeaderMenu->addSeparator();
449450
QAction *organize = new QAction( tr( "&Organize columns..." ), mHorizontalHeaderMenu );
450-
connect( organize, SIGNAL( triggered( bool ) ), this, SLOT( organizeColumns() ) );
451+
connect( organize, &QAction::triggered, this, &QgsDualView::organizeColumns );
451452
mHorizontalHeaderMenu->addAction( organize );
452453
QAction *sort = new QAction( tr( "&Sort..." ), mHorizontalHeaderMenu );
453-
connect( sort, SIGNAL( triggered( bool ) ), this, SLOT( modifySort() ) );
454+
connect( sort, &QAction::triggered, this, &QgsDualView::modifySort );
454455
mHorizontalHeaderMenu->addAction( sort );
455456

456457
mHorizontalHeaderMenu->popup( mTableView->horizontalHeader()->mapToGlobal( point ) );
@@ -536,8 +537,8 @@ void QgsDualView::modifySort()
536537
orderByDlg.setWindowTitle( tr( "Configure attribute table sort order" ) );
537538
QDialogButtonBox *dialogButtonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel );
538539
QGridLayout *layout = new QGridLayout();
539-
connect( dialogButtonBox, SIGNAL( accepted() ), &orderByDlg, SLOT( accept() ) );
540-
connect( dialogButtonBox, SIGNAL( rejected() ), &orderByDlg, SLOT( reject() ) );
540+
connect( dialogButtonBox, &QDialogButtonBox::accepted, &orderByDlg, &QDialog::accept );
541+
connect( dialogButtonBox, &QDialogButtonBox::rejected, &orderByDlg, &QDialog::reject );
541542
orderByDlg.setLayout( layout );
542543

543544
QGroupBox *sortingGroupBox = new QGroupBox();

0 commit comments

Comments
 (0)