From 943d1a2ca50c1ba7e9292cdb8dbb5766a6eb444e Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Tue, 28 Mar 2017 09:18:59 +1000 Subject: [PATCH] More Qt5 style connect conversions --- src/app/qgisapp.h | 11 ++-- src/app/qgsbookmarks.cpp | 40 ++++++------ src/app/qgsbookmarks.h | 4 +- src/app/qgsclipboard.cpp | 2 +- src/app/qgscustomization.cpp | 8 +-- src/app/qgsdecorationcopyrightdialog.cpp | 2 +- src/app/qgsdecorationgriddialog.cpp | 2 +- src/app/qgsdecorationnortharrowdialog.cpp | 2 +- src/app/qgsdecorationscalebardialog.cpp | 2 +- src/app/qgsdxfexportdialog.cpp | 8 +-- src/app/qgsfeatureaction.cpp | 6 +- src/app/qgsfieldcalculator.cpp | 4 +- src/app/qgsfieldsproperties.cpp | 36 +++++------ src/app/qgsguivectorlayertools.cpp | 4 +- src/app/qgshandlebadlayers.cpp | 8 +-- src/app/qgsidentifyresultsdialog.cpp | 71 +++++++++++---------- src/app/qgsjoindialog.cpp | 4 +- src/app/qgslabelengineconfigdialog.cpp | 6 +- src/app/qgslabelinggui.cpp | 14 ++-- src/app/qgslabelingwidget.cpp | 6 +- src/app/qgslayerstylingwidget.cpp | 40 ++++++------ src/app/qgsmaplayerstyleguiutils.cpp | 8 +-- src/app/qgsmaptooladdcircularstring.cpp | 4 +- src/app/qgsmaptoolchangelabelproperties.cpp | 2 +- src/app/qgsmaptoolcircularstringradius.cpp | 2 +- src/app/qgsmaptoolidentifyaction.cpp | 16 ++--- src/app/qgsmaptoolmeasureangle.cpp | 6 +- src/app/qgsmaptooloffsetcurve.cpp | 8 +-- src/app/qgsmaptoolpinlabels.cpp | 4 +- src/app/qgsmaptoolrotatefeature.cpp | 10 +-- src/app/qgsmaptoolsimplify.cpp | 6 +- src/app/qgsmeasuredialog.cpp | 8 +-- src/app/qgsmergeattributesdialog.cpp | 10 +-- src/app/qgsnewspatialitelayerdialog.cpp | 8 +-- 34 files changed, 189 insertions(+), 183 deletions(-) diff --git a/src/app/qgisapp.h b/src/app/qgisapp.h index 7a243c1f960..37f5ab138bc 100644 --- a/src/app/qgisapp.h +++ b/src/app/qgisapp.h @@ -798,6 +798,12 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow void renameView(); + void showProgress( int progress, int totalSteps ); + void showStatusMessage( const QString &message ); + + //! set the active layer + bool setActiveLayer( QgsMapLayer * ); + protected: //! Handle state changes (WindowTitleChange) @@ -1118,8 +1124,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow void showSelectedLayers(); //! Return pointer to the active layer QgsMapLayer *activeLayer(); - //! set the active layer - bool setActiveLayer( QgsMapLayer * ); //! Open the help contents in a browser void helpContents(); //! Open the API documentation in a browser @@ -1263,10 +1267,9 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow void selectionChanged( QgsMapLayer *layer ); - void showProgress( int progress, int totalSteps ); void extentChanged(); void showRotation(); - void showStatusMessage( const QString &message ); + void displayMapToolMessage( const QString &message, QgsMessageBar::MessageLevel level = QgsMessageBar::INFO ); void displayMessage( const QString &title, const QString &message, QgsMessageBar::MessageLevel level ); void removeMapToolMessage(); diff --git a/src/app/qgsbookmarks.cpp b/src/app/qgsbookmarks.cpp index ac05ef33a8b..5e243ab3e0f 100644 --- a/src/app/qgsbookmarks.cpp +++ b/src/app/qgsbookmarks.cpp @@ -56,13 +56,13 @@ QgsBookmarks::QgsBookmarks( QWidget *parent ) QAction *btnImport = share->addAction( tr( "&Import" ) ); btnExport->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionSharingExport.svg" ) ) ); btnImport->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionSharingImport.svg" ) ) ); - connect( btnExport, SIGNAL( triggered() ), this, SLOT( exportToXml() ) ); - connect( btnImport, SIGNAL( triggered() ), this, SLOT( importFromXml() ) ); + connect( btnExport, &QAction::triggered, this, &QgsBookmarks::exportToXml ); + connect( btnImport, &QAction::triggered, this, &QgsBookmarks::importFromXml ); btnImpExp->setMenu( share ); - connect( actionAdd, SIGNAL( triggered() ), this, SLOT( addClicked() ) ); - connect( actionDelete, SIGNAL( triggered() ), this, SLOT( deleteClicked() ) ); - connect( actionZoomTo, SIGNAL( triggered() ), this, SLOT( zoomToBookmark() ) ); + connect( actionAdd, &QAction::triggered, this, &QgsBookmarks::addClicked ); + connect( actionDelete, &QAction::triggered, this, &QgsBookmarks::deleteClicked ); + connect( actionZoomTo, &QAction::triggered, this, &QgsBookmarks::zoomToBookmark ); mBookmarkToolbar->addWidget( btnImpExp ); @@ -394,9 +394,9 @@ void QgsBookmarks::exportToXml() QgsProjectBookmarksTableModel::QgsProjectBookmarksTableModel() { - QObject::connect( - QgisApp::instance(), SIGNAL( projectRead() ), - this, SLOT( projectRead() ) ); + connect( + QgisApp::instance(), &QgisApp::projectRead, + this, &QgsProjectBookmarksTableModel::projectRead ); } int QgsProjectBookmarksTableModel::rowCount( const QModelIndex &parent ) const @@ -507,25 +507,25 @@ QgsMergedBookmarksTableModel::QgsMergedBookmarksTableModel( QAbstractTableModel , mProjectOpen( false ) { connect( - QgisApp::instance(), SIGNAL( projectRead() ), - this, SLOT( projectRead() ) ); + QgisApp::instance(), &QgisApp::projectRead, + this, &QgsMergedBookmarksTableModel::projectRead ); connect( - &mQgisTableModel, SIGNAL( layoutChanged() ), - this, SLOT( allLayoutChanged() ) ); + &mQgisTableModel, &QAbstractTableModel::layoutChanged, + this, &QgsMergedBookmarksTableModel::allLayoutChanged ); connect( - &mQgisTableModel, SIGNAL( dataChanged( const QModelIndex &, const QModelIndex & ) ), - this, SLOT( qgisDataChanged( const QModelIndex &, const QModelIndex & ) ) ); + &mQgisTableModel, &QAbstractTableModel::dataChanged, + this, &QgsMergedBookmarksTableModel::qgisDataChanged ); connect( - &mQgisTableModel, SIGNAL( rowsInserted( const QModelIndex &, int, int ) ), - this, SLOT( allLayoutChanged() ) ); + &mQgisTableModel, &QAbstractTableModel::rowsInserted, + this, &QgsMergedBookmarksTableModel::allLayoutChanged ); connect( - &mQgisTableModel, SIGNAL( rowsRemoved( const QModelIndex &, int, int ) ), - this, SLOT( allLayoutChanged() ) ); + &mQgisTableModel, &QAbstractTableModel::rowsRemoved, + this, &QgsMergedBookmarksTableModel::allLayoutChanged ); connect( - &projectTableModel, SIGNAL( layoutChanged() ), - this, SLOT( allLayoutChanged() ) ); + &projectTableModel, &QAbstractTableModel::layoutChanged, + this, &QgsMergedBookmarksTableModel::allLayoutChanged ); } int QgsMergedBookmarksTableModel::rowCount( const QModelIndex &parent ) const diff --git a/src/app/qgsbookmarks.h b/src/app/qgsbookmarks.h index e1ee9e964cf..3408cb94abf 100644 --- a/src/app/qgsbookmarks.h +++ b/src/app/qgsbookmarks.h @@ -84,8 +84,8 @@ class QgsMergedBookmarksTableModel: public QAbstractTableModel void moveBookmark( QAbstractTableModel &modelFrom, QAbstractTableModel &modelTo, int row ); private slots: - void projectRead() { mProjectOpen = true; }; - void allLayoutChanged() { emit layoutChanged(); }; + void projectRead() { mProjectOpen = true; } + void allLayoutChanged() { emit layoutChanged(); } void qgisDataChanged( const QModelIndex &topLeft, const QModelIndex &bottomRight ) { emit dataChanged( topLeft, bottomRight ); diff --git a/src/app/qgsclipboard.cpp b/src/app/qgsclipboard.cpp index dc9474e3b0b..60b055cee46 100644 --- a/src/app/qgsclipboard.cpp +++ b/src/app/qgsclipboard.cpp @@ -43,7 +43,7 @@ QgsClipboard::QgsClipboard() , mFeatureFields() , mUseSystemClipboard( false ) { - connect( QApplication::clipboard(), SIGNAL( dataChanged() ), this, SLOT( systemClipboardChanged() ) ); + connect( QApplication::clipboard(), &QClipboard::dataChanged, this, &QgsClipboard::systemClipboardChanged ); } QgsClipboard::~QgsClipboard() diff --git a/src/app/qgscustomization.cpp b/src/app/qgscustomization.cpp index 448975158ec..14c99542e60 100644 --- a/src/app/qgscustomization.cpp +++ b/src/app/qgscustomization.cpp @@ -57,10 +57,10 @@ QgsCustomizationDialog::QgsCustomizationDialog( QWidget * parent, QSettings * se mLastDirSettingsName = QStringLiteral( "/UI/lastCustomizationDir" ); //treeWidget->hideColumn(0) - connect( buttonBox->button( QDialogButtonBox::Ok ), SIGNAL( clicked() ), this, SLOT( ok() ) ); - connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) ); - connect( buttonBox->button( QDialogButtonBox::Cancel ), SIGNAL( clicked() ), this, SLOT( cancel() ) ); - connect( buttonBox->button( QDialogButtonBox::Reset ), SIGNAL( clicked() ), this, SLOT( reset() ) ); + connect( buttonBox->button( QDialogButtonBox::Ok ), &QAbstractButton::clicked, this, &QgsCustomizationDialog::ok ); + connect( buttonBox->button( QDialogButtonBox::Apply ), &QAbstractButton::clicked, this, &QgsCustomizationDialog::apply ); + connect( buttonBox->button( QDialogButtonBox::Cancel ), &QAbstractButton::clicked, this, &QgsCustomizationDialog::cancel ); + connect( buttonBox->button( QDialogButtonBox::Reset ), &QAbstractButton::clicked, this, &QgsCustomizationDialog::reset ); } diff --git a/src/app/qgsdecorationcopyrightdialog.cpp b/src/app/qgsdecorationcopyrightdialog.cpp index a6658d19b3b..3c4e1bcf047 100644 --- a/src/app/qgsdecorationcopyrightdialog.cpp +++ b/src/app/qgsdecorationcopyrightdialog.cpp @@ -33,7 +33,7 @@ QgsDecorationCopyrightDialog::QgsDecorationCopyrightDialog( QgsDecorationCopyrig restoreGeometry( settings.value( QStringLiteral( "Windows/DecorationCopyright/geometry" ) ).toByteArray() ); QPushButton *applyButton = buttonBox->button( QDialogButtonBox::Apply ); - connect( applyButton, SIGNAL( clicked() ), this, SLOT( apply() ) ); + connect( applyButton, &QAbstractButton::clicked, this, &QgsDecorationCopyrightDialog::apply ); grpEnable->setChecked( mDeco.enabled() ); // text diff --git a/src/app/qgsdecorationgriddialog.cpp b/src/app/qgsdecorationgriddialog.cpp index e0f3fa9b678..455d9f032ee 100644 --- a/src/app/qgsdecorationgriddialog.cpp +++ b/src/app/qgsdecorationgriddialog.cpp @@ -61,7 +61,7 @@ QgsDecorationGridDialog::QgsDecorationGridDialog( QgsDecorationGrid &deco, QWidg updateGuiElements(); - connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) ); + connect( buttonBox->button( QDialogButtonBox::Apply ), &QAbstractButton::clicked, this, &QgsDecorationGridDialog::apply ); } diff --git a/src/app/qgsdecorationnortharrowdialog.cpp b/src/app/qgsdecorationnortharrowdialog.cpp index 0f4d9aea34b..dff72214ddc 100644 --- a/src/app/qgsdecorationnortharrowdialog.cpp +++ b/src/app/qgsdecorationnortharrowdialog.cpp @@ -31,7 +31,7 @@ QgsDecorationNorthArrowDialog::QgsDecorationNorthArrowDialog( QgsDecorationNorth restoreGeometry( settings.value( QStringLiteral( "Windows/DecorationNorthArrow/geometry" ) ).toByteArray() ); QPushButton *applyButton = buttonBox->button( QDialogButtonBox::Apply ); - connect( applyButton, SIGNAL( clicked() ), this, SLOT( apply() ) ); + connect( applyButton, &QAbstractButton::clicked, this, &QgsDecorationNorthArrowDialog::apply ); // rotation rotatePixmap( mDeco.mRotationInt ); diff --git a/src/app/qgsdecorationscalebardialog.cpp b/src/app/qgsdecorationscalebardialog.cpp index 005e6382f6e..0fabc3f8b58 100644 --- a/src/app/qgsdecorationscalebardialog.cpp +++ b/src/app/qgsdecorationscalebardialog.cpp @@ -30,7 +30,7 @@ QgsDecorationScaleBarDialog::QgsDecorationScaleBarDialog( QgsDecorationScaleBar restoreGeometry( settings.value( QStringLiteral( "Windows/DecorationScaleBar/geometry" ) ).toByteArray() ); QPushButton *applyButton = buttonBox->button( QDialogButtonBox::Apply ); - connect( applyButton, SIGNAL( clicked() ), this, SLOT( apply() ) ); + connect( applyButton, &QAbstractButton::clicked, this, &QgsDecorationScaleBarDialog::apply ); // set the map units in the spin box spnSize->setShowClearButton( false ); diff --git a/src/app/qgsdxfexportdialog.cpp b/src/app/qgsdxfexportdialog.cpp index fb113d3b3c4..6c4ced03754 100644 --- a/src/app/qgsdxfexportdialog.cpp +++ b/src/app/qgsdxfexportdialog.cpp @@ -440,10 +440,10 @@ QgsDxfExportDialog::QgsDxfExportDialog( QWidget *parent, Qt::WindowFlags f ) mTreeView->resizeColumnToContents( 0 ); mTreeView->header()->show(); - connect( mFileLineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( setOkEnabled() ) ); - connect( this, SIGNAL( accepted() ), this, SLOT( saveSettings() ) ); - connect( mSelectAllButton, SIGNAL( clicked() ), this, SLOT( selectAll() ) ); - connect( mDeselectAllButton, SIGNAL( clicked() ), this, SLOT( deSelectAll() ) ); + connect( mFileLineEdit, &QLineEdit::textChanged, this, &QgsDxfExportDialog::setOkEnabled ); + connect( this, &QDialog::accepted, this, &QgsDxfExportDialog::saveSettings ); + connect( mSelectAllButton, &QAbstractButton::clicked, this, &QgsDxfExportDialog::selectAll ); + connect( mDeselectAllButton, &QAbstractButton::clicked, this, &QgsDxfExportDialog::deSelectAll ); mFileLineEdit->setFocus(); diff --git a/src/app/qgsfeatureaction.cpp b/src/app/qgsfeatureaction.cpp index 91e005b4f05..7abaeb4a9a4 100644 --- a/src/app/qgsfeatureaction.cpp +++ b/src/app/qgsfeatureaction.cpp @@ -84,11 +84,11 @@ QgsAttributeDialog *QgsFeatureAction::newDialog( bool cloneFeature ) QgsFeature &feat = const_cast( *dialog->feature() ); QgsFeatureAction *a = new QgsFeatureAction( action.name(), feat, mLayer, action.id(), -1, dialog ); dialog->addAction( a ); - connect( a, SIGNAL( triggered() ), a, SLOT( execute() ) ); + connect( a, &QAction::triggered, a, &QgsFeatureAction::execute ); QAbstractButton *pb = dialog->findChild( action.name() ); if ( pb ) - connect( pb, SIGNAL( clicked() ), a, SLOT( execute() ) ); + connect( pb, &QAbstractButton::clicked, a, &QgsFeatureAction::execute ); } } @@ -207,7 +207,7 @@ bool QgsFeatureAction::addFeature( const QgsAttributeMap &defaultAttributes, boo dialog->setMode( QgsAttributeForm::AddFeatureMode ); dialog->setEditCommandMessage( text() ); - connect( dialog->attributeForm(), SIGNAL( featureSaved( const QgsFeature & ) ), this, SLOT( onFeatureSaved( const QgsFeature & ) ) ); + connect( dialog->attributeForm(), &QgsAttributeForm::featureSaved, this, &QgsFeatureAction::onFeatureSaved ); if ( !showModal ) { diff --git a/src/app/qgsfieldcalculator.cpp b/src/app/qgsfieldcalculator.cpp index 9355dd0c339..1b2d1151a4c 100644 --- a/src/app/qgsfieldcalculator.cpp +++ b/src/app/qgsfieldcalculator.cpp @@ -51,8 +51,8 @@ QgsFieldCalculator::QgsFieldCalculator( QgsVectorLayer *vl, QWidget *parent ) populateFields(); populateOutputFieldTypes(); - connect( builder, SIGNAL( expressionParsed( bool ) ), this, SLOT( setOkButtonState() ) ); - connect( mOutputFieldWidthSpinBox, SIGNAL( editingFinished() ), this, SLOT( setPrecisionMinMax() ) ); + connect( builder, &QgsExpressionBuilderWidget::expressionParsed, this, &QgsFieldCalculator::setOkButtonState ); + connect( mOutputFieldWidthSpinBox, &QAbstractSpinBox::editingFinished, this, &QgsFieldCalculator::setPrecisionMinMax ); QgsDistanceArea myDa; myDa.setSourceCrs( vl->crs() ); diff --git a/src/app/qgsfieldsproperties.cpp b/src/app/qgsfieldsproperties.cpp index 667d632ca73..a463c353149 100644 --- a/src/app/qgsfieldsproperties.cpp +++ b/src/app/qgsfieldsproperties.cpp @@ -63,11 +63,11 @@ QgsFieldsProperties::QgsFieldsProperties( QgsVectorLayer *layer, QWidget *parent mToggleEditingButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionToggleEditing.svg" ) ) ); mCalculateFieldButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionCalculateField.svg" ) ) ); - connect( mToggleEditingButton, SIGNAL( clicked() ), this, SIGNAL( toggleEditing() ) ); - connect( mLayer, SIGNAL( editingStarted() ), this, SLOT( editingToggled() ) ); - connect( mLayer, SIGNAL( editingStopped() ), this, SLOT( editingToggled() ) ); - connect( mLayer, SIGNAL( attributeAdded( int ) ), this, SLOT( attributeAdded( int ) ) ); - connect( mLayer, SIGNAL( attributeDeleted( int ) ), this, SLOT( attributeDeleted( int ) ) ); + connect( mToggleEditingButton, &QAbstractButton::clicked, this, &QgsFieldsProperties::toggleEditing ); + connect( mLayer, &QgsVectorLayer::editingStarted, this, &QgsFieldsProperties::editingToggled ); + connect( mLayer, &QgsVectorLayer::editingStopped, this, &QgsFieldsProperties::editingToggled ); + connect( mLayer, &QgsVectorLayer::attributeAdded, this, &QgsFieldsProperties::attributeAdded ); + connect( mLayer, &QgsVectorLayer::attributeDeleted, this, &QgsFieldsProperties::attributeDeleted ); // tab and group display mAddItemButton->setEnabled( false ); @@ -100,8 +100,8 @@ QgsFieldsProperties::QgsFieldsProperties( QgsVectorLayer *layer, QWidget *parent mFieldsList->setSelectionMode( QAbstractItemView::ExtendedSelection ); mFieldsList->verticalHeader()->hide(); - connect( mDesignerTree, SIGNAL( itemSelectionChanged() ), this, SLOT( onAttributeSelectionChanged() ) ); - connect( mFieldsList, SIGNAL( itemSelectionChanged() ), this, SLOT( onAttributeSelectionChanged() ) ); + connect( mDesignerTree, &QTreeWidget::itemSelectionChanged, this, &QgsFieldsProperties::onAttributeSelectionChanged ); + connect( mFieldsList, &QTableWidget::itemSelectionChanged, this, &QgsFieldsProperties::onAttributeSelectionChanged ); mRelationsList = new DragList( mRelationsFrame ); mRelationsFrameLayout->addWidget( mRelationsList ); @@ -262,7 +262,7 @@ void QgsFieldsProperties::loadAttributeEditorTree() void QgsFieldsProperties::loadRows() { - disconnect( mFieldsList, SIGNAL( cellChanged( int, int ) ), this, SLOT( attributesListCellChanged( int, int ) ) ); + disconnect( mFieldsList, &QTableWidget::cellChanged, this, &QgsFieldsProperties::attributesListCellChanged ); const QgsFields &fields = mLayer->fields(); mIndexedWidgets.clear(); @@ -272,7 +272,7 @@ void QgsFieldsProperties::loadRows() attributeAdded( i ); mFieldsList->resizeColumnsToContents(); - connect( mFieldsList, SIGNAL( cellChanged( int, int ) ), this, SLOT( attributesListCellChanged( int, int ) ) ); + connect( mFieldsList, &QTableWidget::cellChanged, this, &QgsFieldsProperties::attributesListCellChanged ); updateFieldRenamingStatus(); } @@ -310,7 +310,7 @@ void QgsFieldsProperties::setRow( int row, int idx, const QgsField &field ) QToolButton *editExpressionButton = new QToolButton; editExpressionButton->setProperty( "Index", idx ); editExpressionButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mIconExpression.svg" ) ) ); - connect( editExpressionButton, SIGNAL( clicked() ), this, SLOT( updateExpression() ) ); + connect( editExpressionButton, &QAbstractButton::clicked, this, &QgsFieldsProperties::updateExpression ); expressionWidget->layout()->setContentsMargins( 0, 0, 0, 0 ); expressionWidget->layout()->addWidget( editExpressionButton ); expressionWidget->layout()->addWidget( new QLabel( mLayer->expressionField( idx ) ) ); @@ -343,7 +343,7 @@ void QgsFieldsProperties::setRow( int row, int idx, const QgsField &field ) cfg.mButton = pb; mFieldsList->setCellWidget( row, AttrEditTypeCol, pb ); - connect( pb, SIGNAL( pressed() ), this, SLOT( attributeTypeDialog() ) ); + connect( pb, &QAbstractButton::pressed, this, &QgsFieldsProperties::attributeTypeDialog ); setConfigForRow( row, cfg ); @@ -1167,7 +1167,7 @@ DesignerTree::DesignerTree( QgsVectorLayer *layer, QWidget *parent ) : QTreeWidget( parent ) , mLayer( layer ) { - connect( this, SIGNAL( itemDoubleClicked( QTreeWidgetItem *, int ) ), this, SLOT( onItemDoubleClicked( QTreeWidgetItem *, int ) ) ); + connect( this, &QTreeWidget::itemDoubleClicked, this, &DesignerTree::onItemDoubleClicked ); } QTreeWidgetItem *DesignerTree::addItem( QTreeWidgetItem *parent, QgsFieldsProperties::DesignerTreeItemData data ) @@ -1370,8 +1370,8 @@ void DesignerTree::onItemDoubleClicked( QTreeWidgetItem *item, int column ) QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel ); - connect( buttonBox, SIGNAL( accepted() ), &dlg, SLOT( accept() ) ); - connect( buttonBox, SIGNAL( rejected() ), &dlg, SLOT( reject() ) ); + connect( buttonBox, &QDialogButtonBox::accepted, &dlg, &QDialog::accept ); + connect( buttonBox, &QDialogButtonBox::rejected, &dlg, &QDialog::reject ); layout->addWidget( buttonBox ); @@ -1408,8 +1408,8 @@ void DesignerTree::onItemDoubleClicked( QTreeWidgetItem *item, int column ) QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel ); - connect( buttonBox, SIGNAL( accepted() ), &dlg, SLOT( accept() ) ); - connect( buttonBox, SIGNAL( rejected() ), &dlg, SLOT( reject() ) ); + connect( buttonBox, &QDialogButtonBox::accepted, &dlg, &QDialog::accept ); + connect( buttonBox, &QDialogButtonBox::rejected, &dlg, &QDialog::reject ); dlg.layout()->addWidget( buttonBox ); @@ -1434,8 +1434,8 @@ void DesignerTree::onItemDoubleClicked( QTreeWidgetItem *item, int column ) QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel ); - connect( buttonBox, SIGNAL( accepted() ), &dlg, SLOT( accept() ) ); - connect( buttonBox, SIGNAL( rejected() ), &dlg, SLOT( reject() ) ); + connect( buttonBox, &QDialogButtonBox::accepted, &dlg, &QDialog::accept ); + connect( buttonBox, &QDialogButtonBox::rejected, &dlg, &QDialog::reject ); dlg.layout()->addWidget( buttonBox ); diff --git a/src/app/qgsguivectorlayertools.cpp b/src/app/qgsguivectorlayertools.cpp index cf915b223e9..cfaf5dbeeb4 100644 --- a/src/app/qgsguivectorlayertools.cpp +++ b/src/app/qgsguivectorlayertools.cpp @@ -178,8 +178,8 @@ void QgsGuiVectorLayerTools::commitError( QgsVectorLayer *vlayer ) const showMore->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Preferred ); showMore->addAction( act ); showMore->setDefaultAction( act ); - connect( showMore, SIGNAL( triggered( QAction * ) ), mv, SLOT( exec() ) ); - connect( showMore, SIGNAL( triggered( QAction * ) ), showMore, SLOT( deleteLater() ) ); + connect( showMore, &QToolButton::triggered, mv, &QDialog::exec ); + connect( showMore, &QToolButton::triggered, showMore, &QObject::deleteLater ); // no timeout set, since notice needs attention and is only shown first time layer is labeled QgsMessageBarItem *errorMsg = new QgsMessageBarItem( diff --git a/src/app/qgshandlebadlayers.cpp b/src/app/qgshandlebadlayers.cpp index 8abb05162c6..1a6f628ca2b 100644 --- a/src/app/qgshandlebadlayers.cpp +++ b/src/app/qgshandlebadlayers.cpp @@ -72,9 +72,9 @@ QgsHandleBadLayers::QgsHandleBadLayers( const QList &layers ) buttonBox->addButton( mBrowseButton, QDialogButtonBox::ActionRole ); mBrowseButton->setDisabled( true ); - connect( mLayerList, SIGNAL( itemSelectionChanged() ), this, SLOT( selectionChanged() ) ); - connect( mBrowseButton, SIGNAL( clicked() ), this, SLOT( browseClicked() ) ); - connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) ); + connect( mLayerList, &QTableWidget::itemSelectionChanged, this, &QgsHandleBadLayers::selectionChanged ); + connect( mBrowseButton, &QAbstractButton::clicked, this, &QgsHandleBadLayers::browseClicked ); + connect( buttonBox->button( QDialogButtonBox::Apply ), &QAbstractButton::clicked, this, &QgsHandleBadLayers::apply ); mLayerList->clear(); mLayerList->setSortingEnabled( true ); @@ -133,7 +133,7 @@ QgsHandleBadLayers::QgsHandleBadLayers( const QList &layers ) btn->setMinimumHeight( 24 ); btn->setText( tr( "Edit" ) ); btn->setProperty( "row", j ); - connect( btn, SIGNAL( clicked() ), this, SLOT( editAuthCfg() ) ); + connect( btn, &QAbstractButton::clicked, this, &QgsHandleBadLayers::editAuthCfg ); mLayerList->setCellWidget( j, 3, btn ); } else diff --git a/src/app/qgsidentifyresultsdialog.cpp b/src/app/qgsidentifyresultsdialog.cpp index f29db41ce55..6d0dbbfe2f9 100644 --- a/src/app/qgsidentifyresultsdialog.cpp +++ b/src/app/qgsidentifyresultsdialog.cpp @@ -89,8 +89,8 @@ QgsIdentifyResultsWebView::QgsIdentifyResultsWebView( QWidget *parent ) : QgsWeb #ifdef QGISDEBUG settings()->setAttribute( QWebSettings::DeveloperExtrasEnabled, true ); #endif - connect( page(), SIGNAL( downloadRequested( QNetworkRequest ) ), this, SLOT( downloadRequested( QNetworkRequest ) ) ); - connect( page(), SIGNAL( unsupportedContent( QNetworkReply * ) ), this, SLOT( unsupportedContent( QNetworkReply * ) ) ); + connect( page(), &QWebPage::downloadRequested, this, &QgsIdentifyResultsWebView::downloadRequested ); + connect( page(), &QWebPage::unsupportedContent, this, &QgsIdentifyResultsWebView::unsupportedContent ); } @@ -153,7 +153,7 @@ void QgsIdentifyResultsWebView::contextMenuEvent( QContextMenuEvent *e ) return; QAction *action = new QAction( tr( "Print" ), this ); - connect( action, SIGNAL( triggered() ), this, SLOT( print() ) ); + connect( action, &QAction::triggered, this, &QgsIdentifyResultsWebView::print ); menu->addAction( action ); menu->exec( e->globalPos() ); delete menu; @@ -272,7 +272,7 @@ QgsIdentifyResultsWebViewItem::QgsIdentifyResultsWebViewItem( QTreeWidget *treeW mWebView = new QgsIdentifyResultsWebView( treeWidget ); mWebView->hide(); setText( 0, tr( "Loading..." ) ); - connect( mWebView->page(), SIGNAL( loadFinished( bool ) ), this, SLOT( loadFinished( bool ) ) ); + connect( mWebView->page(), &QWebPage::loadFinished, this, &QgsIdentifyResultsWebViewItem::loadFinished ); } void QgsIdentifyResultsWebViewItem::loadFinished( bool ok ) @@ -285,7 +285,7 @@ void QgsIdentifyResultsWebViewItem::loadFinished( bool ok ) // Span columns to save some space, must be after setItemWidget() to take effect. setFirstColumnSpanned( true ); - disconnect( mWebView->page(), SIGNAL( loadFinished( bool ) ), this, SLOT( loadFinished( bool ) ) ); + disconnect( mWebView->page(), &QWebPage::loadFinished, this, &QgsIdentifyResultsWebViewItem::loadFinished ); } @@ -389,19 +389,19 @@ QgsIdentifyResultsDialog::QgsIdentifyResultsDialog( QgsMapCanvas *canvas, QWidge mPlot->setSizePolicy( sizePolicy ); mPlot->updateGeometry(); - connect( lstResults, SIGNAL( itemExpanded( QTreeWidgetItem * ) ), - this, SLOT( itemExpanded( QTreeWidgetItem * ) ) ); + connect( lstResults, &QTreeWidget::itemExpanded, + this, &QgsIdentifyResultsDialog::itemExpanded ); - connect( lstResults, SIGNAL( currentItemChanged( QTreeWidgetItem *, QTreeWidgetItem * ) ), - this, SLOT( handleCurrentItemChanged( QTreeWidgetItem *, QTreeWidgetItem * ) ) ); + connect( lstResults, &QTreeWidget::currentItemChanged, + this, &QgsIdentifyResultsDialog::handleCurrentItemChanged ); - connect( lstResults, SIGNAL( itemClicked( QTreeWidgetItem *, int ) ), - this, SLOT( itemClicked( QTreeWidgetItem *, int ) ) ); + connect( lstResults, &QTreeWidget::itemClicked, + this, &QgsIdentifyResultsDialog::itemClicked ); - connect( mActionPrint, SIGNAL( triggered( bool ) ), this, SLOT( printCurrentItem() ) ); - connect( mOpenFormAction, SIGNAL( triggered( bool ) ), this, SLOT( featureForm() ) ); - connect( mClearResultsAction, SIGNAL( triggered( bool ) ), this, SLOT( clear() ) ); - connect( mHelpToolButton, SIGNAL( clicked() ), this, SLOT( helpRequested() ) ); + connect( mActionPrint, &QAction::triggered, this, &QgsIdentifyResultsDialog::printCurrentItem ); + connect( mOpenFormAction, &QAction::triggered, this, &QgsIdentifyResultsDialog::featureForm ); + connect( mClearResultsAction, &QAction::triggered, this, &QgsIdentifyResultsDialog::clear ); + connect( mHelpToolButton, &QAbstractButton::clicked, this, &QgsIdentifyResultsDialog::helpRequested ); } QgsIdentifyResultsDialog::~QgsIdentifyResultsDialog() @@ -453,13 +453,13 @@ void QgsIdentifyResultsDialog::addFeature( QgsVectorLayer *vlayer, const QgsFeat layItem->setData( 0, Qt::UserRole, QVariant::fromValue( qobject_cast( vlayer ) ) ); lstResults->addTopLevelItem( layItem ); - connect( vlayer, SIGNAL( destroyed() ), this, SLOT( layerDestroyed() ) ); - connect( vlayer, SIGNAL( crsChanged() ), this, SLOT( layerDestroyed() ) ); - connect( vlayer, SIGNAL( featureDeleted( QgsFeatureId ) ), this, SLOT( featureDeleted( QgsFeatureId ) ) ); - connect( vlayer, SIGNAL( attributeValueChanged( QgsFeatureId, int, const QVariant & ) ), - this, SLOT( attributeValueChanged( QgsFeatureId, int, const QVariant & ) ) ); - connect( vlayer, SIGNAL( editingStarted() ), this, SLOT( editingToggled() ) ); - connect( vlayer, SIGNAL( editingStopped() ), this, SLOT( editingToggled() ) ); + connect( vlayer, &QObject::destroyed, this, &QgsIdentifyResultsDialog::layerDestroyed ); + connect( vlayer, &QgsMapLayer::crsChanged, this, &QgsIdentifyResultsDialog::layerDestroyed ); + connect( vlayer, &QgsVectorLayer::featureDeleted, this, &QgsIdentifyResultsDialog::featureDeleted ); + connect( vlayer, &QgsVectorLayer::attributeValueChanged, + this, &QgsIdentifyResultsDialog::attributeValueChanged ); + connect( vlayer, &QgsVectorLayer::editingStarted, this, &QgsIdentifyResultsDialog::editingToggled ); + connect( vlayer, &QgsVectorLayer::editingStopped, this, &QgsIdentifyResultsDialog::editingToggled ); } QgsIdentifyResultsFeatureItem *featItem = new QgsIdentifyResultsFeatureItem( vlayer->fields(), f, vlayer->crs() ); @@ -522,7 +522,7 @@ void QgsIdentifyResultsDialog::addFeature( QgsVectorLayer *vlayer, const QgsFeat twi->setData( 0, Qt::UserRole + 1, qVariantFromValue( qobject_cast( action ) ) ); actionItem->addChild( twi ); - connect( action, SIGNAL( destroyed() ), this, SLOT( mapLayerActionDestroyed() ) ); + connect( action, &QObject::destroyed, this, &QgsIdentifyResultsDialog::mapLayerActionDestroyed ); } } @@ -798,15 +798,16 @@ void QgsIdentifyResultsDialog::addFeature( QgsRasterLayer *layer, QTreeWidgetItem *formatItem = new QTreeWidgetItem( QStringList() << ' ' + tr( "Format" ) ); layItem->addChild( formatItem ); lstResults->setItemWidget( formatItem, 1, formatCombo ); - connect( formatCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( formatChanged( int ) ) ); + connect( formatCombo, static_cast( &QComboBox::currentIndexChanged ), + this, static_cast( &QgsIdentifyResultsDialog::formatChanged ) ); } else { delete formatCombo; } - connect( layer, SIGNAL( destroyed() ), this, SLOT( layerDestroyed() ) ); - connect( layer, SIGNAL( crsChanged() ), this, SLOT( layerDestroyed() ) ); + connect( layer, &QObject::destroyed, this, &QgsIdentifyResultsDialog::layerDestroyed ); + connect( layer, &QgsMapLayer::crsChanged, this, &QgsIdentifyResultsDialog::layerDestroyed ); } // Set/reset getFeatureInfoUrl (currently only available for Feature, so it may change if format changes) layItem->setData( 0, GetFeatureInfoUrlRole, params.value( QStringLiteral( "getFeatureInfoUrl" ) ) ); @@ -1481,14 +1482,14 @@ void QgsIdentifyResultsDialog::disconnectLayer( QObject *layer ) QgsVectorLayer *vlayer = qobject_cast( layer ); if ( vlayer ) { - disconnect( vlayer, SIGNAL( featureDeleted( QgsFeatureId ) ), this, SLOT( featureDeleted( QgsFeatureId ) ) ); - disconnect( vlayer, SIGNAL( attributeValueChanged( QgsFeatureId, int, const QVariant & ) ), - this, SLOT( attributeValueChanged( QgsFeatureId, int, const QVariant & ) ) ); - disconnect( vlayer, SIGNAL( editingStarted() ), this, SLOT( editingToggled() ) ); - disconnect( vlayer, SIGNAL( editingStopped() ), this, SLOT( editingToggled() ) ); + disconnect( vlayer, &QgsVectorLayer::featureDeleted, this, &QgsIdentifyResultsDialog::featureDeleted ); + disconnect( vlayer, &QgsVectorLayer::attributeValueChanged, + this, &QgsIdentifyResultsDialog::attributeValueChanged ); + disconnect( vlayer, &QgsVectorLayer::editingStarted, this, &QgsIdentifyResultsDialog::editingToggled ); + disconnect( vlayer, &QgsVectorLayer::editingStopped, this, &QgsIdentifyResultsDialog::editingToggled ); } - disconnect( layer, SIGNAL( destroyed() ), this, SLOT( layerDestroyed() ) ); + disconnect( layer, &QObject::destroyed, this, &QgsIdentifyResultsDialog::layerDestroyed ); } void QgsIdentifyResultsDialog::featureDeleted( QgsFeatureId fid ) @@ -1742,9 +1743,11 @@ void QgsIdentifyResultsDialog::layerProperties() void QgsIdentifyResultsDialog::activateLayer() { - connect( this, SIGNAL( activateLayer( QgsMapLayer * ) ), QgisApp::instance(), SLOT( setActiveLayer( QgsMapLayer * ) ) ); + connect( this, static_cast( &QgsIdentifyResultsDialog::activateLayer ) + , QgisApp::instance(), &QgisApp::setActiveLayer ); emit activateLayer( layer( lstResults->currentItem() ) ); - disconnect( this, SIGNAL( activateLayer( QgsMapLayer * ) ), QgisApp::instance(), SLOT( setActiveLayer( QgsMapLayer * ) ) ); + disconnect( this, static_cast( &QgsIdentifyResultsDialog::activateLayer ), + QgisApp::instance(), &QgisApp::setActiveLayer ); } void QgsIdentifyResultsDialog::layerProperties( QTreeWidgetItem *item ) diff --git a/src/app/qgsjoindialog.cpp b/src/app/qgsjoindialog.cpp index 480992c567c..299e435b34e 100644 --- a/src/app/qgsjoindialog.cpp +++ b/src/app/qgsjoindialog.cpp @@ -57,8 +57,8 @@ QgsJoinDialog::QgsJoinDialog( QgsVectorLayer *layer, QList alread } connect( mJoinLayerComboBox, &QgsMapLayerComboBox::layerChanged, this, &QgsJoinDialog::checkDefinitionValid ); - connect( mJoinFieldComboBox, SIGNAL( fieldChanged( QString ) ), this, SLOT( checkDefinitionValid() ) ); - connect( mTargetFieldComboBox, SIGNAL( fieldChanged( QString ) ), this, SLOT( checkDefinitionValid() ) ); + connect( mJoinFieldComboBox, &QgsFieldComboBox::fieldChanged, this, &QgsJoinDialog::checkDefinitionValid ); + connect( mTargetFieldComboBox, &QgsFieldComboBox::fieldChanged, this, &QgsJoinDialog::checkDefinitionValid ); checkDefinitionValid(); } diff --git a/src/app/qgslabelengineconfigdialog.cpp b/src/app/qgslabelengineconfigdialog.cpp index 55f3d40d0b1..e3096e8a484 100644 --- a/src/app/qgslabelengineconfigdialog.cpp +++ b/src/app/qgslabelengineconfigdialog.cpp @@ -26,9 +26,9 @@ QgsLabelEngineConfigDialog::QgsLabelEngineConfigDialog( QWidget *parent ) { setupUi( this ); - connect( buttonBox, SIGNAL( accepted() ), this, SLOT( onOK() ) ); - connect( buttonBox->button( QDialogButtonBox::RestoreDefaults ), SIGNAL( clicked() ), - this, SLOT( setDefaults() ) ); + connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsLabelEngineConfigDialog::onOK ); + connect( buttonBox->button( QDialogButtonBox::RestoreDefaults ), &QAbstractButton::clicked, + this, &QgsLabelEngineConfigDialog::setDefaults ); QgsLabelingEngine engine; engine.readSettingsFromProject( QgsProject::instance() ); diff --git a/src/app/qgslabelinggui.cpp b/src/app/qgslabelinggui.cpp index 4725f9f06df..8d39b416ccb 100644 --- a/src/app/qgslabelinggui.cpp +++ b/src/app/qgslabelinggui.cpp @@ -63,13 +63,13 @@ QgsLabelingGui::QgsLabelingGui( QgsVectorLayer *layer, QgsMapCanvas *mapCanvas, , mMode( NoLabels ) { // connections for groupboxes with separate activation checkboxes (that need to honor data defined setting) - connect( mBufferDrawChkBx, SIGNAL( toggled( bool ) ), this, SLOT( updateUi() ) ); - connect( mShapeDrawChkBx, SIGNAL( toggled( bool ) ), this, SLOT( updateUi() ) ); - connect( mShadowDrawChkBx, SIGNAL( toggled( bool ) ), this, SLOT( updateUi() ) ); - connect( mDirectSymbChkBx, SIGNAL( toggled( bool ) ), this, SLOT( updateUi() ) ); - connect( mFormatNumChkBx, SIGNAL( toggled( bool ) ), this, SLOT( updateUi() ) ); - connect( mScaleBasedVisibilityChkBx, SIGNAL( toggled( bool ) ), this, SLOT( updateUi() ) ); - connect( mFontLimitPixelChkBox, SIGNAL( toggled( bool ) ), this, SLOT( updateUi() ) ); + connect( mBufferDrawChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi ); + connect( mShapeDrawChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi ); + connect( mShadowDrawChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi ); + connect( mDirectSymbChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi ); + connect( mFormatNumChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi ); + connect( mScaleBasedVisibilityChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi ); + connect( mFontLimitPixelChkBox, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi ); mFieldExpressionWidget->registerExpressionContextGenerator( this ); diff --git a/src/app/qgslabelingwidget.cpp b/src/app/qgslabelingwidget.cpp index 6e60228470c..670e71cd398 100644 --- a/src/app/qgslabelingwidget.cpp +++ b/src/app/qgslabelingwidget.cpp @@ -33,14 +33,14 @@ QgsLabelingWidget::QgsLabelingWidget( QgsVectorLayer *layer, QgsMapCanvas *canva { setupUi( this ); - connect( mEngineSettingsButton, SIGNAL( clicked() ), this, SLOT( showEngineConfigDialog() ) ); + connect( mEngineSettingsButton, &QAbstractButton::clicked, this, &QgsLabelingWidget::showEngineConfigDialog ); mLabelModeComboBox->setCurrentIndex( -1 ); mLabelGui = new QgsLabelingGui( nullptr, mCanvas, nullptr, this ); mStackedWidget->addWidget( mLabelGui ); - connect( mLabelModeComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( labelModeChanged( int ) ) ); - connect( mLabelGui, SIGNAL( widgetChanged() ), this, SIGNAL( widgetChanged() ) ); + connect( mLabelModeComboBox, static_cast( &QComboBox::currentIndexChanged ), this, &QgsLabelingWidget::labelModeChanged ); + connect( mLabelGui, &QgsTextFormatWidget::widgetChanged, this, &QgsLabelingWidget::widgetChanged ); setLayer( layer ); } diff --git a/src/app/qgslayerstylingwidget.cpp b/src/app/qgslayerstylingwidget.cpp index b97e044b8b5..d4aca84d82d 100644 --- a/src/app/qgslayerstylingwidget.cpp +++ b/src/app/qgslayerstylingwidget.cpp @@ -58,7 +58,7 @@ QgsLayerStylingWidget::QgsLayerStylingWidget( QgsMapCanvas *canvas, const QList< { setupUi( this ); - connect( QgsProject::instance(), SIGNAL( layerWillBeRemoved( QgsMapLayer * ) ), this, SLOT( layerAboutToBeRemoved( QgsMapLayer * ) ) ); + connect( QgsProject::instance(), static_cast < void ( QgsProject::* )( QgsMapLayer * ) > ( &QgsProject::layerWillBeRemoved ), this, &QgsLayerStylingWidget::layerAboutToBeRemoved ); QgsSettings settings; mLiveApplyCheck->setChecked( settings.value( QStringLiteral( "UI/autoApplyStyling" ), true ).toBool() ); @@ -76,15 +76,15 @@ QgsLayerStylingWidget::QgsLayerStylingWidget( QgsMapCanvas *canvas, const QList< QList l; setPageFactories( pages ); - connect( mUndoButton, SIGNAL( pressed() ), this, SLOT( undo() ) ); - connect( mRedoButton, SIGNAL( pressed() ), this, SLOT( redo() ) ); + connect( mUndoButton, &QAbstractButton::pressed, this, &QgsLayerStylingWidget::undo ); + connect( mRedoButton, &QAbstractButton::pressed, this, &QgsLayerStylingWidget::redo ); - connect( mAutoApplyTimer, SIGNAL( timeout() ), this, SLOT( apply() ) ); + connect( mAutoApplyTimer, &QTimer::timeout, this, &QgsLayerStylingWidget::apply ); - connect( mOptionsListWidget, SIGNAL( currentRowChanged( int ) ), this, SLOT( updateCurrentWidgetLayer() ) ); - connect( mButtonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) ); + connect( mOptionsListWidget, &QListWidget::currentRowChanged, this, &QgsLayerStylingWidget::updateCurrentWidgetLayer ); + connect( mButtonBox->button( QDialogButtonBox::Apply ), &QAbstractButton::clicked, this, &QgsLayerStylingWidget::apply ); connect( mLayerCombo, &QgsMapLayerComboBox::layerChanged, this, &QgsLayerStylingWidget::setLayer ); - connect( mLiveApplyCheck, SIGNAL( toggled( bool ) ), this, SLOT( liveApplyToggled( bool ) ) ); + connect( mLiveApplyCheck, &QAbstractButton::toggled, this, &QgsLayerStylingWidget::liveApplyToggled ); mStackedWidget->setCurrentIndex( 0 ); } @@ -108,11 +108,11 @@ void QgsLayerStylingWidget::blockUpdates( bool blocked ) if ( blocked ) { - disconnect( mCurrentLayer, SIGNAL( styleChanged() ), this, SLOT( updateCurrentWidgetLayer() ) ); + disconnect( mCurrentLayer, &QgsMapLayer::styleChanged, this, &QgsLayerStylingWidget::updateCurrentWidgetLayer ); } else { - connect( mCurrentLayer, SIGNAL( styleChanged() ), this, SLOT( updateCurrentWidgetLayer() ) ); + connect( mCurrentLayer, &QgsMapLayer::styleChanged, this, &QgsLayerStylingWidget::updateCurrentWidgetLayer ); } } @@ -123,7 +123,7 @@ void QgsLayerStylingWidget::setLayer( QgsMapLayer *layer ) if ( mCurrentLayer ) { - disconnect( mCurrentLayer, SIGNAL( styleChanged() ), this, SLOT( updateCurrentWidgetLayer() ) ); + disconnect( mCurrentLayer, &QgsMapLayer::styleChanged, this, &QgsLayerStylingWidget::updateCurrentWidgetLayer ); } if ( !layer || !layer->isSpatial() ) @@ -145,7 +145,7 @@ void QgsLayerStylingWidget::setLayer( QgsMapLayer *layer ) mUndoWidget->setUndoStack( layer->undoStackStyles() ); - connect( mCurrentLayer, SIGNAL( styleChanged() ), this, SLOT( updateCurrentWidgetLayer() ) ); + connect( mCurrentLayer, &QgsMapLayer::styleChanged, this, &QgsLayerStylingWidget::updateCurrentWidgetLayer ); int lastPage = mOptionsListWidget->currentIndex().row(); mOptionsListWidget->blockSignals( true ); @@ -222,7 +222,7 @@ void QgsLayerStylingWidget::apply() if ( !mCurrentLayer ) return; - disconnect( mCurrentLayer, SIGNAL( styleChanged() ), this, SLOT( updateCurrentWidgetLayer() ) ); + disconnect( mCurrentLayer, &QgsMapLayer::styleChanged, this, &QgsLayerStylingWidget::updateCurrentWidgetLayer ); QString undoName = QStringLiteral( "Style Change" ); @@ -270,7 +270,7 @@ void QgsLayerStylingWidget::apply() QgsProject::instance()->setDirty( true ); mCurrentLayer->triggerRepaint(); } - connect( mCurrentLayer, SIGNAL( styleChanged() ), this, SLOT( updateCurrentWidgetLayer() ) ); + connect( mCurrentLayer, &QgsMapLayer::styleChanged, this, &QgsLayerStylingWidget::updateCurrentWidgetLayer ); } void QgsLayerStylingWidget::autoApply() @@ -332,7 +332,7 @@ void QgsLayerStylingWidget::updateCurrentWidgetLayer() QgsMapLayerConfigWidget *panel = mUserPages[row]->createWidget( mCurrentLayer, mMapCanvas, true, mWidgetStack ); if ( panel ) { - connect( panel, SIGNAL( widgetChanged( QgsPanelWidget * ) ), this, SLOT( autoApply() ) ); + connect( panel, &QgsPanelWidget::widgetChanged, this, &QgsLayerStylingWidget::autoApply ); mWidgetStack->setMainPanel( panel ); } } @@ -353,7 +353,7 @@ void QgsLayerStylingWidget::updateCurrentWidgetLayer() QgsRendererPropertiesDialog *styleWidget = new QgsRendererPropertiesDialog( vlayer, QgsStyle::defaultStyle(), true, mStackedWidget ); styleWidget->setMapCanvas( mMapCanvas ); styleWidget->setDockMode( true ); - connect( styleWidget, SIGNAL( widgetChanged() ), this, SLOT( autoApply() ) ); + connect( styleWidget, &QgsRendererPropertiesDialog::widgetChanged, this, &QgsLayerStylingWidget::autoApply ); QgsPanelWidgetWrapper *wrapper = new QgsPanelWidgetWrapper( styleWidget, mStackedWidget ); wrapper->setDockMode( true ); connect( styleWidget, &QgsRendererPropertiesDialog::showPanel, wrapper, &QgsPanelWidget::openPanel ); @@ -366,7 +366,7 @@ void QgsLayerStylingWidget::updateCurrentWidgetLayer() { mLabelingWidget = new QgsLabelingWidget( 0, mMapCanvas, mWidgetStack ); mLabelingWidget->setDockMode( true ); - connect( mLabelingWidget, SIGNAL( widgetChanged() ), this, SLOT( autoApply() ) ); + connect( mLabelingWidget, &QgsLabelingWidget::widgetChanged, this, &QgsLayerStylingWidget::autoApply ); } mLabelingWidget->setLayer( vlayer ); mWidgetStack->setMainPanel( mLabelingWidget ); @@ -415,7 +415,7 @@ void QgsLayerStylingWidget::updateCurrentWidgetLayer() } } mRasterStyleWidget->setDockMode( true ); - connect( mRasterStyleWidget, SIGNAL( widgetChanged() ), this, SLOT( autoApply() ) ); + connect( mRasterStyleWidget, &QgsPanelWidget::widgetChanged, this, &QgsLayerStylingWidget::autoApply ); mWidgetStack->setMainPanel( mRasterStyleWidget ); break; } @@ -424,7 +424,7 @@ void QgsLayerStylingWidget::updateCurrentWidgetLayer() { QgsRasterTransparencyWidget *transwidget = new QgsRasterTransparencyWidget( rlayer, mMapCanvas, mWidgetStack ); transwidget->setDockMode( true ); - connect( transwidget, SIGNAL( widgetChanged() ), this, SLOT( autoApply() ) ); + connect( transwidget, &QgsPanelWidget::widgetChanged, this, &QgsLayerStylingWidget::autoApply ); mWidgetStack->setMainPanel( transwidget ); break; } @@ -437,10 +437,10 @@ void QgsLayerStylingWidget::updateCurrentWidgetLayer() mRasterStyleWidget = new QgsRendererRasterPropertiesWidget( rlayer, mMapCanvas, mWidgetStack ); mRasterStyleWidget->syncToLayer( rlayer ); } - connect( mRasterStyleWidget, SIGNAL( widgetChanged() ), this, SLOT( autoApply() ) ); + connect( mRasterStyleWidget, &QgsPanelWidget::widgetChanged, this, &QgsLayerStylingWidget::autoApply ); QgsRasterHistogramWidget *widget = new QgsRasterHistogramWidget( rlayer, mWidgetStack ); - connect( widget, SIGNAL( widgetChanged() ), this, SLOT( autoApply() ) ); + connect( widget, &QgsPanelWidget::widgetChanged, this, &QgsLayerStylingWidget::autoApply ); QString name = mRasterStyleWidget->currentRenderWidget()->renderer()->type(); widget->setRendererWidget( name, mRasterStyleWidget->currentRenderWidget() ); widget->setDockMode( true ); diff --git a/src/app/qgsmaplayerstyleguiutils.cpp b/src/app/qgsmaplayerstyleguiutils.cpp index ca251534ba2..38a16c3b3eb 100644 --- a/src/app/qgsmaplayerstyleguiutils.cpp +++ b/src/app/qgsmaplayerstyleguiutils.cpp @@ -35,14 +35,14 @@ QAction *QgsMapLayerStyleGuiUtils::actionAddStyle( QgsMapLayer *layer, QObject * { QAction *a = new QAction( tr( "Add..." ), parent ); a->setData( QVariant::fromValue( layer ) ); - connect( a, SIGNAL( triggered() ), this, SLOT( addStyle() ) ); + connect( a, &QAction::triggered, this, &QgsMapLayerStyleGuiUtils::addStyle ); return a; } QAction *QgsMapLayerStyleGuiUtils::actionRemoveStyle( QgsMapLayer *layer, QObject *parent ) { QAction *a = new QAction( tr( "Remove Current" ), parent ); - a->connect( a, SIGNAL( triggered() ), this, SLOT( removeStyle() ) ); + connect( a, &QAction::triggered, this, &QgsMapLayerStyleGuiUtils::removeStyle ); a->setData( QVariant::fromValue( layer ) ); a->setEnabled( layer->styleManager()->styles().count() > 1 ); return a; @@ -51,7 +51,7 @@ QAction *QgsMapLayerStyleGuiUtils::actionRemoveStyle( QgsMapLayer *layer, QObjec QAction *QgsMapLayerStyleGuiUtils::actionRenameStyle( QgsMapLayer *layer, QObject *parent ) { QAction *a = new QAction( tr( "Rename Current..." ), parent ); - a->connect( a, SIGNAL( triggered() ), this, SLOT( renameStyle() ) ); + connect( a, &QAction::triggered, this, &QgsMapLayerStyleGuiUtils::renameStyle ); a->setData( QVariant::fromValue( layer ) ); return a; } @@ -68,7 +68,7 @@ QList QgsMapLayerStyleGuiUtils::actionsUseStyle( QgsMapLayer *layer, if ( name.isEmpty() ) name = defaultStyleName(); QAction *actionUse = new QAction( name, parent ); - connect( actionUse, SIGNAL( triggered() ), this, SLOT( useStyle() ) ); + connect( actionUse, &QAction::triggered, this, &QgsMapLayerStyleGuiUtils::useStyle ); actionUse->setCheckable( true ); actionUse->setChecked( active ); actionUse->setEnabled( !onlyOneStyle ); diff --git a/src/app/qgsmaptooladdcircularstring.cpp b/src/app/qgsmaptooladdcircularstring.cpp index 5b56f6d7cda..53dc8464acf 100644 --- a/src/app/qgsmaptooladdcircularstring.cpp +++ b/src/app/qgsmaptooladdcircularstring.cpp @@ -34,7 +34,7 @@ QgsMapToolAddCircularString::QgsMapToolAddCircularString( QgsMapToolCapture *par { if ( mCanvas ) { - connect( mCanvas, SIGNAL( mapToolSet( QgsMapTool *, QgsMapTool * ) ), this, SLOT( setParentTool( QgsMapTool *, QgsMapTool * ) ) ); + connect( mCanvas, &QgsMapCanvas::mapToolSet, this, &QgsMapToolAddCircularString::setParentTool ); } } @@ -48,7 +48,7 @@ QgsMapToolAddCircularString::QgsMapToolAddCircularString( QgsMapCanvas *canvas ) { if ( mCanvas ) { - connect( mCanvas, SIGNAL( mapToolSet( QgsMapTool *, QgsMapTool * ) ), this, SLOT( setParentTool( QgsMapTool *, QgsMapTool * ) ) ); + connect( mCanvas, &QgsMapCanvas::mapToolSet, this, &QgsMapToolAddCircularString::setParentTool ); } } diff --git a/src/app/qgsmaptoolchangelabelproperties.cpp b/src/app/qgsmaptoolchangelabelproperties.cpp index 54074fd616b..5f9adb3a703 100644 --- a/src/app/qgsmaptoolchangelabelproperties.cpp +++ b/src/app/qgsmaptoolchangelabelproperties.cpp @@ -66,7 +66,7 @@ void QgsMapToolChangeLabelProperties::canvasReleaseEvent( QgsMapMouseEvent *e ) mCurrentLabel.pos.labelFont, labeltext, nullptr ); - connect( &d, SIGNAL( applied() ), this, SLOT( dialogPropertiesApplied() ) ); + connect( &d, &QgsLabelPropertyDialog::applied, this, &QgsMapToolChangeLabelProperties::dialogPropertiesApplied ); if ( d.exec() == QDialog::Accepted ) { applyChanges( d.changedProperties() ); diff --git a/src/app/qgsmaptoolcircularstringradius.cpp b/src/app/qgsmaptoolcircularstringradius.cpp index ef7d4ccad7c..98bfff9b70a 100644 --- a/src/app/qgsmaptoolcircularstringradius.cpp +++ b/src/app/qgsmaptoolcircularstringradius.cpp @@ -159,7 +159,7 @@ void QgsMapToolCircularStringRadius::createRadiusSpinBox() mRadiusSpinBox->setPrefix( tr( "Radius: " ) ); mRadiusSpinBox->setValue( mRadius ); QgisApp::instance()->addUserInputWidget( mRadiusSpinBox ); - QObject::connect( mRadiusSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( updateRadiusFromSpinBox( double ) ) ); + connect( mRadiusSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsMapToolCircularStringRadius::updateRadiusFromSpinBox ); mRadiusSpinBox->setFocus( Qt::TabFocusReason ); } diff --git a/src/app/qgsmaptoolidentifyaction.cpp b/src/app/qgsmaptoolidentifyaction.cpp index 56da5e561d8..8499edd0eb9 100644 --- a/src/app/qgsmaptoolidentifyaction.cpp +++ b/src/app/qgsmaptoolidentifyaction.cpp @@ -52,12 +52,12 @@ QgsMapToolIdentifyAction::QgsMapToolIdentifyAction( QgsMapCanvas *canvas ) QPixmap myIdentifyQPixmap = QPixmap( ( const char ** ) identify_cursor ); mCursor = QCursor( myIdentifyQPixmap, 1, 1 ); - connect( this, SIGNAL( changedRasterResults( QList & ) ), this, SLOT( handleChangedRasterResults( QList & ) ) ); + connect( this, &QgsMapToolIdentify::changedRasterResults, this, &QgsMapToolIdentifyAction::handleChangedRasterResults ); mIdentifyMenu->setAllowMultipleReturn( true ); QgsMapLayerAction *attrTableAction = new QgsMapLayerAction( tr( "Show attribute table" ), mIdentifyMenu, QgsMapLayer::VectorLayer, QgsMapLayerAction::MultipleFeatures ); - connect( attrTableAction, SIGNAL( triggeredForFeatures( QgsMapLayer *, const QList ) ), this, SLOT( showAttributeTable( QgsMapLayer *, const QList ) ) ); + connect( attrTableAction, &QgsMapLayerAction::triggeredForFeatures, this, &QgsMapToolIdentifyAction::showAttributeTable ); identifyMenu()->addCustomAction( attrTableAction ); } @@ -75,8 +75,8 @@ QgsIdentifyResultsDialog *QgsMapToolIdentifyAction::resultsDialog() { mResultsDialog = new QgsIdentifyResultsDialog( mCanvas, mCanvas->window() ); - connect( mResultsDialog, SIGNAL( formatChanged( QgsRasterLayer * ) ), this, SLOT( formatChanged( QgsRasterLayer * ) ) ); - connect( mResultsDialog, SIGNAL( copyToClipboard( QgsFeatureStore & ) ), this, SLOT( handleCopyToClipboard( QgsFeatureStore & ) ) ); + connect( mResultsDialog.data(), static_cast( &QgsIdentifyResultsDialog::formatChanged ), this, &QgsMapToolIdentify::formatChanged ); + connect( mResultsDialog.data(), &QgsIdentifyResultsDialog::copyToClipboard, this, &QgsMapToolIdentifyAction::handleCopyToClipboard ); } return mResultsDialog; @@ -115,8 +115,8 @@ void QgsMapToolIdentifyAction::canvasPressEvent( QgsMapMouseEvent *e ) void QgsMapToolIdentifyAction::canvasReleaseEvent( QgsMapMouseEvent *e ) { resultsDialog()->clear(); - connect( this, SIGNAL( identifyProgress( int, int ) ), QgisApp::instance(), SLOT( showProgress( int, int ) ) ); - connect( this, SIGNAL( identifyMessage( QString ) ), QgisApp::instance(), SLOT( showStatusMessage( QString ) ) ); + connect( this, &QgsMapToolIdentifyAction::identifyProgress, QgisApp::instance(), &QgisApp::showProgress ); + connect( this, &QgsMapToolIdentifyAction::identifyMessage, QgisApp::instance(), &QgisApp::showStatusMessage ); identifyMenu()->setResultsIfExternalAction( false ); @@ -129,8 +129,8 @@ void QgsMapToolIdentifyAction::canvasReleaseEvent( QgsMapMouseEvent *e ) QList results = QgsMapToolIdentify::identify( e->x(), e->y(), mode ); - disconnect( this, SIGNAL( identifyProgress( int, int ) ), QgisApp::instance(), SLOT( showProgress( int, int ) ) ); - disconnect( this, SIGNAL( identifyMessage( QString ) ), QgisApp::instance(), SLOT( showStatusMessage( QString ) ) ); + disconnect( this, &QgsMapToolIdentifyAction::identifyProgress, QgisApp::instance(), &QgisApp::showProgress ); + disconnect( this, &QgsMapToolIdentifyAction::identifyMessage, QgisApp::instance(), &QgisApp::showStatusMessage ); if ( results.isEmpty() ) { diff --git a/src/app/qgsmaptoolmeasureangle.cpp b/src/app/qgsmaptoolmeasureangle.cpp index 4d6d07722fa..c938830e7d2 100644 --- a/src/app/qgsmaptoolmeasureangle.cpp +++ b/src/app/qgsmaptoolmeasureangle.cpp @@ -34,8 +34,8 @@ QgsMapToolMeasureAngle::QgsMapToolMeasureAngle( QgsMapCanvas *canvas ) { mToolName = tr( "Measure angle" ); - connect( canvas, SIGNAL( destinationCrsChanged() ), - this, SLOT( updateSettings() ) ); + connect( canvas, &QgsMapCanvas::destinationCrsChanged, + this, &QgsMapToolMeasureAngle::updateSettings ); } QgsMapToolMeasureAngle::~QgsMapToolMeasureAngle() @@ -96,7 +96,7 @@ void QgsMapToolMeasureAngle::canvasReleaseEvent( QgsMapMouseEvent *e ) { mResultDisplay = new QgsDisplayAngle( this ); mResultDisplay->setWindowFlags( mResultDisplay->windowFlags() | Qt::Tool ); - QObject::connect( mResultDisplay, SIGNAL( rejected() ), this, SLOT( stopMeasuring() ) ); + connect( mResultDisplay, &QDialog::rejected, this, &QgsMapToolMeasureAngle::stopMeasuring ); } configureDistanceArea(); createRubberBand(); diff --git a/src/app/qgsmaptooloffsetcurve.cpp b/src/app/qgsmaptooloffsetcurve.cpp index 18b860eb27f..87ebfa93cc3 100644 --- a/src/app/qgsmaptooloffsetcurve.cpp +++ b/src/app/qgsmaptooloffsetcurve.cpp @@ -334,16 +334,16 @@ void QgsMapToolOffsetCurve::createDistanceWidget() mDistanceWidget->setFocus( Qt::TabFocusReason ); - QObject::connect( mDistanceWidget, SIGNAL( valueChanged( double ) ), this, SLOT( placeOffsetCurveToValue() ) ); - QObject::connect( mDistanceWidget, SIGNAL( editingFinished() ), this, SLOT( applyOffset() ) ); + connect( mDistanceWidget, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsMapToolOffsetCurve::placeOffsetCurveToValue ); + connect( mDistanceWidget, &QAbstractSpinBox::editingFinished, this, &QgsMapToolOffsetCurve::applyOffset ); } void QgsMapToolOffsetCurve::deleteDistanceWidget() { if ( mDistanceWidget ) { - QObject::disconnect( mDistanceWidget, SIGNAL( valueChanged( double ) ), this, SLOT( placeOffsetCurveToValue() ) ); - QObject::disconnect( mDistanceWidget, SIGNAL( editingFinished() ), this, SLOT( applyOffset() ) ); + disconnect( mDistanceWidget, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsMapToolOffsetCurve::placeOffsetCurveToValue ); + disconnect( mDistanceWidget, &QAbstractSpinBox::editingFinished, this, &QgsMapToolOffsetCurve::applyOffset ); mDistanceWidget->releaseKeyboard(); mDistanceWidget->deleteLater(); } diff --git a/src/app/qgsmaptoolpinlabels.cpp b/src/app/qgsmaptoolpinlabels.cpp index 3f5b0ace623..97a4591c9fe 100644 --- a/src/app/qgsmaptoolpinlabels.cpp +++ b/src/app/qgsmaptoolpinlabels.cpp @@ -36,8 +36,8 @@ QgsMapToolPinLabels::QgsMapToolPinLabels( QgsMapCanvas *canvas ) { mToolName = tr( "Pin labels" ); - connect( QgisApp::instance()->actionToggleEditing(), SIGNAL( triggered() ), this, SLOT( updatePinnedLabels() ) ); - connect( canvas, SIGNAL( renderComplete( QPainter * ) ), this, SLOT( highlightPinnedLabels() ) ); + connect( QgisApp::instance()->actionToggleEditing(), &QAction::triggered, this, &QgsMapToolPinLabels::updatePinnedLabels ); + connect( canvas, &QgsMapCanvas::renderComplete, this, &QgsMapToolPinLabels::highlightPinnedLabels ); } QgsMapToolPinLabels::~QgsMapToolPinLabels() diff --git a/src/app/qgsmaptoolrotatefeature.cpp b/src/app/qgsmaptoolrotatefeature.cpp index e41e417b0b2..644bc15fbab 100644 --- a/src/app/qgsmaptoolrotatefeature.cpp +++ b/src/app/qgsmaptoolrotatefeature.cpp @@ -74,7 +74,7 @@ QgsAngleMagnetWidget::QgsAngleMagnetWidget( const QString &label, QWidget *paren // connect signals mAngleSpinBox->installEventFilter( this ); - connect( mAngleSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( angleSpinBoxValueChanged( double ) ) ); + connect( mAngleSpinBox, static_cast < void ( QgsDoubleSpinBox::* )( double ) > ( &QgsDoubleSpinBox::valueChanged ), this, &QgsAngleMagnetWidget::angleSpinBoxValueChanged ); // config focus setFocusProxy( mAngleSpinBox ); @@ -466,16 +466,16 @@ void QgsMapToolRotateFeature::createRotationWidget() QgisApp::instance()->addUserInputWidget( mRotationWidget ); mRotationWidget->setFocus( Qt::TabFocusReason ); - QObject::connect( mRotationWidget, SIGNAL( angleChanged( double ) ), this, SLOT( updateRubberband( double ) ) ); - QObject::connect( mRotationWidget, SIGNAL( angleEditingFinished( double ) ), this, SLOT( applyRotation( double ) ) ); + connect( mRotationWidget, &QgsAngleMagnetWidget::angleChanged, this, &QgsMapToolRotateFeature::updateRubberband ); + connect( mRotationWidget, &QgsAngleMagnetWidget::angleEditingFinished, this, &QgsMapToolRotateFeature::applyRotation ); } void QgsMapToolRotateFeature::deleteRotationWidget() { if ( mRotationWidget ) { - QObject::disconnect( mRotationWidget, SIGNAL( angleChanged( double ) ), this, SLOT( updateRubberband( double ) ) ); - QObject::disconnect( mRotationWidget, SIGNAL( angleEditingFinished( double ) ), this, SLOT( applyRotation( double ) ) ); + disconnect( mRotationWidget, &QgsAngleMagnetWidget::angleChanged, this, &QgsMapToolRotateFeature::updateRubberband ); + disconnect( mRotationWidget, &QgsAngleMagnetWidget::angleEditingFinished, this, &QgsMapToolRotateFeature::applyRotation ); mRotationWidget->releaseKeyboard(); mRotationWidget->deleteLater(); } diff --git a/src/app/qgsmaptoolsimplify.cpp b/src/app/qgsmaptoolsimplify.cpp index 706aa7febed..f1afa636ae8 100644 --- a/src/app/qgsmaptoolsimplify.cpp +++ b/src/app/qgsmaptoolsimplify.cpp @@ -39,9 +39,9 @@ QgsSimplifyDialog::QgsSimplifyDialog( QgsMapToolSimplify *tool, QWidget *parent cboToleranceUnits->setCurrentIndex( ( int ) mTool->toleranceUnits() ); // communication with map tool - connect( spinTolerance, SIGNAL( valueChanged( double ) ), mTool, SLOT( setTolerance( double ) ) ); - connect( cboToleranceUnits, SIGNAL( currentIndexChanged( int ) ), mTool, SLOT( setToleranceUnits( int ) ) ); - connect( okButton, SIGNAL( clicked() ), mTool, SLOT( storeSimplified() ) ); + connect( spinTolerance, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), mTool, &QgsMapToolSimplify::setTolerance ); + connect( cboToleranceUnits, static_cast( &QComboBox::currentIndexChanged ), mTool, &QgsMapToolSimplify::setToleranceUnits ); + connect( okButton, &QAbstractButton::clicked, mTool, &QgsMapToolSimplify::storeSimplified ); } void QgsSimplifyDialog::updateStatusText() diff --git a/src/app/qgsmeasuredialog.cpp b/src/app/qgsmeasuredialog.cpp index 77a96b02923..5f6604518fb 100644 --- a/src/app/qgsmeasuredialog.cpp +++ b/src/app/qgsmeasuredialog.cpp @@ -39,12 +39,12 @@ QgsMeasureDialog::QgsMeasureDialog( QgsMeasureTool *tool, Qt::WindowFlags f ) QPushButton *nb = new QPushButton( tr( "&New" ) ); buttonBox->addButton( nb, QDialogButtonBox::ActionRole ); - connect( nb, SIGNAL( clicked() ), this, SLOT( restart() ) ); + connect( nb, &QAbstractButton::clicked, this, &QgsMeasureDialog::restart ); // Add a configuration button QPushButton *cb = new QPushButton( tr( "&Configuration" ) ); buttonBox->addButton( cb, QDialogButtonBox::ActionRole ); - connect( cb, SIGNAL( clicked() ), this, SLOT( openConfigTab() ) ); + connect( cb, &QAbstractButton::clicked, this, &QgsMeasureDialog::openConfigTab ); mMeasureArea = tool->measureArea(); mTotal = 0.; @@ -66,8 +66,8 @@ QgsMeasureDialog::QgsMeasureDialog( QgsMeasureTool *tool, Qt::WindowFlags f ) updateSettings(); - connect( mUnitsCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( unitsChanged( int ) ) ); - connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) ); + connect( mUnitsCombo, static_cast( &QComboBox::currentIndexChanged ), this, &QgsMeasureDialog::unitsChanged ); + connect( buttonBox, &QDialogButtonBox::rejected, this, &QgsMeasureDialog::reject ); connect( mTool->canvas(), &QgsMapCanvas::destinationCrsChanged, this, &QgsMeasureDialog::crsChanged ); groupBox->setCollapsed( true ); diff --git a/src/app/qgsmergeattributesdialog.cpp b/src/app/qgsmergeattributesdialog.cpp index b1188532ef0..e662c4c9df9 100644 --- a/src/app/qgsmergeattributesdialog.cpp +++ b/src/app/qgsmergeattributesdialog.cpp @@ -62,7 +62,7 @@ QgsMergeAttributesDialog::QgsMergeAttributesDialog( const QgsFeatureList &featur QHeaderView *verticalHeader = mTableWidget->verticalHeader(); if ( verticalHeader ) { - QObject::connect( mTableWidget, SIGNAL( itemSelectionChanged() ), this, SLOT( selectedRowChanged() ) ); + connect( mTableWidget, &QTableWidget::itemSelectionChanged, this, &QgsMergeAttributesDialog::selectedRowChanged ); } mTableWidget->setSelectionBehavior( QAbstractItemView::SelectRows ); mTableWidget->setSelectionMode( QAbstractItemView::SingleSelection ); @@ -73,8 +73,8 @@ QgsMergeAttributesDialog::QgsMergeAttributesDialog( const QgsFeatureList &featur QgsSettings settings; restoreGeometry( settings.value( QStringLiteral( "Windows/MergeAttributes/geometry" ) ).toByteArray() ); - connect( mSkipAllButton, SIGNAL( clicked() ), this, SLOT( setAllToSkip() ) ); - connect( mTableWidget, SIGNAL( cellChanged( int, int ) ), this, SLOT( tableWidgetCellChanged( int, int ) ) ); + connect( mSkipAllButton, &QAbstractButton::clicked, this, &QgsMergeAttributesDialog::setAllToSkip ); + connect( mTableWidget, &QTableWidget::cellChanged, this, &QgsMergeAttributesDialog::tableWidgetCellChanged ); } QgsMergeAttributesDialog::QgsMergeAttributesDialog() @@ -210,8 +210,8 @@ QComboBox *QgsMergeAttributesDialog::createMergeComboBox( QVariant::Type columnT newComboBox->addItem( tr( "Skip attribute" ), "skip" ); newComboBox->addItem( tr( "Manual value" ), "manual" ); - QObject::connect( newComboBox, SIGNAL( currentIndexChanged( const QString & ) ), - this, SLOT( comboValueChanged( const QString & ) ) ); + connect( newComboBox, static_cast( &QComboBox::currentIndexChanged ), + this, &QgsMergeAttributesDialog::comboValueChanged ); return newComboBox; } diff --git a/src/app/qgsnewspatialitelayerdialog.cpp b/src/app/qgsnewspatialitelayerdialog.cpp index 98ed8b1e7c7..f6182574e8f 100644 --- a/src/app/qgsnewspatialitelayerdialog.cpp +++ b/src/app/qgsnewspatialitelayerdialog.cpp @@ -78,10 +78,10 @@ QgsNewSpatialiteLayerDialog::QgsNewSpatialiteLayerDialog( QWidget *parent, Qt::W pbnFindSRID->setEnabled( mDatabaseComboBox->count() ); - connect( mNameEdit, SIGNAL( textChanged( QString ) ), this, SLOT( nameChanged( QString ) ) ); - connect( mAttributeView, SIGNAL( itemSelectionChanged() ), this, SLOT( selectionChanged() ) ); - connect( leLayerName, SIGNAL( textChanged( QString ) ), this, SLOT( checkOk() ) ); - connect( checkBoxPrimaryKey, SIGNAL( clicked() ), this, SLOT( checkOk() ) ); + connect( mNameEdit, &QLineEdit::textChanged, this, &QgsNewSpatialiteLayerDialog::nameChanged ); + connect( mAttributeView, &QTreeWidget::itemSelectionChanged, this, &QgsNewSpatialiteLayerDialog::selectionChanged ); + connect( leLayerName, &QLineEdit::textChanged, this, &QgsNewSpatialiteLayerDialog::checkOk ); + connect( checkBoxPrimaryKey, &QAbstractButton::clicked, this, &QgsNewSpatialiteLayerDialog::checkOk ); mAddAttributeButton->setEnabled( false ); mRemoveAttributeButton->setEnabled( false );