@@ -63,9 +63,9 @@ QgsDualView::QgsDualView( QWidget *parent )
63
63
mActionExpressionPreview ->setIcon ( QgsApplication::getThemeIcon ( QStringLiteral ( " /mIconExpressionPreview.svg" ) ) );
64
64
65
65
// 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 );
69
69
}
70
70
71
71
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
77
77
78
78
mEditorContext = context;
79
79
80
- connect ( mTableView , SIGNAL ( willShowContextMenu ( QMenu *, QModelIndex ) ), this , SLOT ( viewWillShowContextMenu ( QMenu *, QModelIndex ) ) );
80
+ connect ( mTableView , &QgsAttributeTableView:: willShowContextMenu, this , &QgsDualView:: viewWillShowContextMenu );
81
81
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 );
84
84
85
85
initLayerCache ( !request.filterRect ().isNull () );
86
86
initModels ( mapCanvas, request );
@@ -103,11 +103,11 @@ void QgsDualView::init( QgsVectorLayer *layer, QgsMapCanvas *mapCanvas, const Qg
103
103
mAttributeEditor ->layout ()->addWidget ( mAttributeForm );
104
104
}
105
105
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 );
111
111
if ( mFeatureListPreviewButton ->defaultAction () )
112
112
mFeatureList ->setDisplayExpression ( mDisplayExpression );
113
113
else
@@ -152,7 +152,8 @@ void QgsDualView::columnBoxInit()
152
152
// Generate action for the preview popup button of the feature list
153
153
QAction *previewAction = new QAction ( icon, text, mFeatureListPreviewButton );
154
154
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
+ );
156
157
mPreviewColumnsMenu ->addAction ( previewAction );
157
158
158
159
if ( text == defaultField )
@@ -175,7 +176,7 @@ void QgsDualView::columnBoxInit()
175
176
}
176
177
177
178
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 );
179
180
mFeatureListPreviewButton ->addAction ( sortByPreviewExpression );
180
181
}
181
182
@@ -209,8 +210,8 @@ void QgsDualView::initLayerCache( bool cacheGeometry )
209
210
mLayerCache ->setCacheGeometry ( cacheGeometry );
210
211
if ( 0 == cacheSize || 0 == ( QgsVectorDataProvider::SelectAtId & mLayer ->dataProvider ()->capabilities () ) )
211
212
{
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 );
214
215
215
216
mLayerCache ->setFullCache ( true );
216
217
}
@@ -227,16 +228,16 @@ void QgsDualView::initModels( QgsMapCanvas *mapCanvas, const QgsFeatureRequest &
227
228
mMasterModel ->setEditorContext ( mEditorContext );
228
229
mMasterModel ->setExtraColumns ( 1 ); // Add one extra column which we can "abuse" as an action column
229
230
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 );
232
233
233
- connect ( mConditionalFormatWidget , SIGNAL ( rulesUpdated ( QString ) ) , mMasterModel , SLOT ( fieldConditionalStyleChanged ( QString ) ) );
234
+ connect ( mConditionalFormatWidget , &QgsFieldConditionalFormatWidget:: rulesUpdated, mMasterModel , &QgsAttributeTableModel:: fieldConditionalStyleChanged );
234
235
235
236
mMasterModel ->loadLayer ();
236
237
237
238
mFilterModel = new QgsAttributeTableFilterModel ( mapCanvas, mMasterModel , mMasterModel );
238
239
239
- connect ( mFeatureList , SIGNAL ( displayExpressionChanged ( QString ) ) , this , SIGNAL ( displayExpressionChanged ( QString ) ) );
240
+ connect ( mFeatureList , &QgsFeatureListView:: displayExpressionChanged, this , &QgsDualView:: displayExpressionChanged );
240
241
241
242
mFeatureListModel = new QgsFeatureListModel ( mFilterModel , mFilterModel );
242
243
}
@@ -378,7 +379,7 @@ void QgsDualView::viewWillShowContextMenu( QMenu *menu, const QModelIndex &atInd
378
379
QAction *copyContentAction = new QAction ( tr ( " Copy cell content" ), this );
379
380
copyContentAction->setData ( QVariant::fromValue<QModelIndex>( sourceIndex ) );
380
381
menu->addAction ( copyContentAction );
381
- connect ( copyContentAction, SIGNAL ( triggered () ) , this , SLOT ( copyCellContent () ) );
382
+ connect ( copyContentAction, &QAction:: triggered, this , &QgsDualView:: copyCellContent );
382
383
383
384
QgsVectorLayer *vl = mFilterModel ->layer ();
384
385
QgsMapCanvas *canvas = mFilterModel ->mapCanvas ();
@@ -433,24 +434,24 @@ void QgsDualView::showViewHeaderMenu( QPoint point )
433
434
mHorizontalHeaderMenu = new QMenu ( this );
434
435
435
436
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 );
437
438
hide->setData ( col );
438
439
mHorizontalHeaderMenu ->addAction ( hide );
439
440
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 );
441
442
setWidth->setData ( col );
442
443
mHorizontalHeaderMenu ->addAction ( setWidth );
443
444
QAction *optimizeWidth = new QAction ( tr ( " &Autosize" ), mHorizontalHeaderMenu );
444
- connect ( optimizeWidth, SIGNAL ( triggered ( bool ) ) , this , SLOT ( autosizeColumn () ) );
445
+ connect ( optimizeWidth, &QAction:: triggered, this , &QgsDualView:: autosizeColumn );
445
446
optimizeWidth->setData ( col );
446
447
mHorizontalHeaderMenu ->addAction ( optimizeWidth );
447
448
448
449
mHorizontalHeaderMenu ->addSeparator ();
449
450
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 );
451
452
mHorizontalHeaderMenu ->addAction ( organize );
452
453
QAction *sort = new QAction ( tr ( " &Sort..." ), mHorizontalHeaderMenu );
453
- connect ( sort, SIGNAL ( triggered ( bool ) ) , this , SLOT ( modifySort () ) );
454
+ connect ( sort, &QAction:: triggered, this , &QgsDualView:: modifySort );
454
455
mHorizontalHeaderMenu ->addAction ( sort );
455
456
456
457
mHorizontalHeaderMenu ->popup ( mTableView ->horizontalHeader ()->mapToGlobal ( point ) );
@@ -536,8 +537,8 @@ void QgsDualView::modifySort()
536
537
orderByDlg.setWindowTitle ( tr ( " Configure attribute table sort order" ) );
537
538
QDialogButtonBox *dialogButtonBox = new QDialogButtonBox ( QDialogButtonBox::Ok | QDialogButtonBox::Cancel );
538
539
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 );
541
542
orderByDlg.setLayout ( layout );
542
543
543
544
QGroupBox *sortingGroupBox = new QGroupBox ();
0 commit comments