diff --git a/src/analysis/openstreetmap/qgsosmdownload.cpp b/src/analysis/openstreetmap/qgsosmdownload.cpp index defd1c03302..c5c595792fa 100644 --- a/src/analysis/openstreetmap/qgsosmdownload.cpp +++ b/src/analysis/openstreetmap/qgsosmdownload.cpp @@ -84,10 +84,10 @@ bool QgsOSMDownload::start() mReply = nwam->get( request ); - connect( mReply, SIGNAL( readyRead() ), this, SLOT( onReadyRead() ) ); - connect( mReply, SIGNAL( error( QNetworkReply::NetworkError ) ), this, SLOT( onError( QNetworkReply::NetworkError ) ) ); - connect( mReply, SIGNAL( finished() ), this, SLOT( onFinished() ) ); - connect( mReply, SIGNAL( downloadProgress( qint64, qint64 ) ), this, SIGNAL( downloadProgress( qint64, qint64 ) ) ); + connect( mReply, &QIODevice::readyRead, this, &QgsOSMDownload::onReadyRead ); + connect( mReply, static_cast < void ( QNetworkReply::* )( QNetworkReply::NetworkError ) >( &QNetworkReply::error ), this, &QgsOSMDownload::onError ); + connect( mReply, &QNetworkReply::finished, this, &QgsOSMDownload::onFinished ); + connect( mReply, &QNetworkReply::downloadProgress, this, &QgsOSMDownload::downloadProgress ); return true; } diff --git a/src/app/composer/qgsatlascompositionwidget.cpp b/src/app/composer/qgsatlascompositionwidget.cpp index 13db79bc599..7ca575976ca 100644 --- a/src/app/composer/qgsatlascompositionwidget.cpp +++ b/src/app/composer/qgsatlascompositionwidget.cpp @@ -34,16 +34,16 @@ QgsAtlasCompositionWidget::QgsAtlasCompositionWidget( QWidget *parent, QgsCompos connect( mAtlasCoverageLayerComboBox, &QgsMapLayerComboBox::layerChanged, mAtlasSortFeatureKeyComboBox, &QgsFieldComboBox::setLayer ); connect( mAtlasCoverageLayerComboBox, &QgsMapLayerComboBox::layerChanged, mPageNameWidget, &QgsFieldExpressionWidget::setLayer ); - connect( mAtlasCoverageLayerComboBox, SIGNAL( layerChanged( QgsMapLayer * ) ), this, SLOT( changeCoverageLayer( QgsMapLayer * ) ) ); - connect( mAtlasSortFeatureKeyComboBox, SIGNAL( fieldChanged( QString ) ), this, SLOT( changesSortFeatureField( QString ) ) ); - connect( mPageNameWidget, SIGNAL( fieldChanged( QString, bool ) ), this, SLOT( pageNameExpressionChanged( QString, bool ) ) ); + connect( mAtlasCoverageLayerComboBox, &QgsMapLayerComboBox::layerChanged, this, &QgsAtlasCompositionWidget::changeCoverageLayer ); + connect( mAtlasSortFeatureKeyComboBox, &QgsFieldComboBox::fieldChanged, this, &QgsAtlasCompositionWidget::changesSortFeatureField ); + connect( mPageNameWidget, static_cast < void ( QgsFieldExpressionWidget::* )( const QString &, bool ) > ( &QgsFieldExpressionWidget::fieldChanged ), this, &QgsAtlasCompositionWidget::pageNameExpressionChanged ); // Sort direction mAtlasSortFeatureDirectionButton->setEnabled( false ); mAtlasSortFeatureKeyComboBox->setEnabled( false ); // connect to updates - connect( &mComposition->atlasComposition(), SIGNAL( parameterChanged() ), this, SLOT( updateGuiElements() ) ); + connect( &mComposition->atlasComposition(), &QgsAtlasComposition::parameterChanged, this, &QgsAtlasCompositionWidget::updateGuiElements ); mPageNameWidget->registerExpressionContextGenerator( mComposition ); diff --git a/src/app/composer/qgsattributeselectiondialog.cpp b/src/app/composer/qgsattributeselectiondialog.cpp index 8914382859e..911bb683cc4 100644 --- a/src/app/composer/qgsattributeselectiondialog.cpp +++ b/src/app/composer/qgsattributeselectiondialog.cpp @@ -120,7 +120,7 @@ QWidget *QgsComposerColumnSourceDelegate::createEditor( QWidget *parent, const Q fieldExpression->registerExpressionContextGenerator( this ); //listen out for field changes - connect( fieldExpression, SIGNAL( fieldChanged( QString ) ), this, SLOT( commitAndCloseEditor() ) ); + connect( fieldExpression, static_cast < void ( QgsFieldExpressionWidget::* )( const QString & ) >( &QgsFieldExpressionWidget::fieldChanged ), this, [ = ] { const_cast< QgsComposerColumnSourceDelegate * >( this )->commitAndCloseEditor(); } ); return fieldExpression; } diff --git a/src/app/composer/qgscomposerarrowwidget.cpp b/src/app/composer/qgscomposerarrowwidget.cpp index 5cebb5e4652..1edb861bcaf 100644 --- a/src/app/composer/qgscomposerarrowwidget.cpp +++ b/src/app/composer/qgscomposerarrowwidget.cpp @@ -57,7 +57,7 @@ QgsComposerArrowWidget::QgsComposerArrowWidget( QgsComposerArrow *arrow ): QgsCo if ( arrow ) { - connect( arrow, SIGNAL( itemChanged() ), this, SLOT( setGuiElementValues() ) ); + connect( arrow, &QgsComposerObject::itemChanged, this, &QgsComposerArrowWidget::setGuiElementValues ); } } @@ -339,7 +339,7 @@ void QgsComposerArrowWidget::on_mLineStyleButton_clicked() symbolContext.setExpressionContext( &context ); d->setContext( symbolContext ); - connect( d, SIGNAL( widgetChanged() ), this, SLOT( updateLineStyleFromWidget() ) ); + connect( d, &QgsPanelWidget::widgetChanged, this, &QgsComposerArrowWidget::updateLineStyleFromWidget ); connect( d, &QgsPanelWidget::panelAccepted, this, &QgsComposerArrowWidget::cleanUpLineStyleSelector ); openPanel( d ); mArrow->beginCommand( tr( "Arrow line style changed" ) ); diff --git a/src/app/composer/qgscomposerattributetablewidget.cpp b/src/app/composer/qgscomposerattributetablewidget.cpp index f5e3afdfdbc..1ed428ed284 100644 --- a/src/app/composer/qgscomposerattributetablewidget.cpp +++ b/src/app/composer/qgscomposerattributetablewidget.cpp @@ -58,14 +58,14 @@ QgsComposerAttributeTableWidget::QgsComposerAttributeTableWidget( QgsComposerAtt toggleAtlasSpecificControls( atlasEnabled ); //update relations combo when relations modified in project - connect( QgsProject::instance()->relationManager(), SIGNAL( changed() ), this, SLOT( updateRelationsCombo() ) ); + connect( QgsProject::instance()->relationManager(), &QgsRelationManager::changed, this, &QgsComposerAttributeTableWidget::updateRelationsCombo ); mLayerComboBox->setFilters( QgsMapLayerProxyModel::VectorLayer ); - connect( mLayerComboBox, SIGNAL( layerChanged( QgsMapLayer * ) ), this, SLOT( changeLayer( QgsMapLayer * ) ) ); + connect( mLayerComboBox, &QgsMapLayerComboBox::layerChanged, this, &QgsComposerAttributeTableWidget::changeLayer ); mComposerMapComboBox->setComposition( mComposerTable->composition() ); mComposerMapComboBox->setItemType( QgsComposerItem::ComposerMap ); - connect( mComposerMapComboBox, SIGNAL( itemChanged( QgsComposerItem * ) ), this, SLOT( composerMapChanged( QgsComposerItem * ) ) ); + connect( mComposerMapComboBox, &QgsComposerItemComboBox::itemChanged, this, &QgsComposerAttributeTableWidget::composerMapChanged ); mHeaderFontColorButton->setColorDialogTitle( tr( "Select header font color" ) ); mHeaderFontColorButton->setAllowAlpha( true ); @@ -87,15 +87,15 @@ QgsComposerAttributeTableWidget::QgsComposerAttributeTableWidget( QgsComposerAtt if ( mComposerTable ) { - QObject::connect( mComposerTable, SIGNAL( changed() ), this, SLOT( updateGuiElements() ) ); + connect( mComposerTable, &QgsComposerMultiFrame::changed, this, &QgsComposerAttributeTableWidget::updateGuiElements ); QgsAtlasComposition *atlas = atlasComposition(); if ( atlas ) { // repopulate relations combo box if atlas layer changes - connect( atlas, SIGNAL( coverageLayerChanged( QgsVectorLayer * ) ), - this, SLOT( updateRelationsCombo() ) ); - connect( atlas, SIGNAL( toggled( bool ) ), this, SLOT( atlasToggled() ) ); + connect( atlas, &QgsAtlasComposition::coverageLayerChanged, + this, &QgsComposerAttributeTableWidget::updateRelationsCombo ); + connect( atlas, &QgsAtlasComposition::toggled, this, &QgsComposerAttributeTableWidget::atlasToggled ); } } diff --git a/src/app/composer/qgscomposerhtmlwidget.cpp b/src/app/composer/qgscomposerhtmlwidget.cpp index 5de6b9e065d..eb0fee73de9 100644 --- a/src/app/composer/qgscomposerhtmlwidget.cpp +++ b/src/app/composer/qgscomposerhtmlwidget.cpp @@ -36,12 +36,12 @@ QgsComposerHtmlWidget::QgsComposerHtmlWidget( QgsComposerHtml *html, QgsComposer //setup html editor mHtmlEditor = new QgsCodeEditorHTML( this ); - connect( mHtmlEditor, SIGNAL( textChanged() ), this, SLOT( htmlEditorChanged() ) ); + connect( mHtmlEditor, &QsciScintilla::textChanged, this, &QgsComposerHtmlWidget::htmlEditorChanged ); htmlEditorLayout->addWidget( mHtmlEditor ); //setup stylesheet editor mStylesheetEditor = new QgsCodeEditorCSS( this ); - connect( mStylesheetEditor, SIGNAL( textChanged() ), this, SLOT( stylesheetEditorChanged() ) ); + connect( mStylesheetEditor, &QsciScintilla::textChanged, this, &QgsComposerHtmlWidget::stylesheetEditorChanged ); stylesheetEditorLayout->addWidget( mStylesheetEditor ); blockSignals( true ); @@ -54,7 +54,7 @@ QgsComposerHtmlWidget::QgsComposerHtmlWidget( QgsComposerHtml *html, QgsComposer if ( mHtml ) { - QObject::connect( mHtml, SIGNAL( changed() ), this, SLOT( setGuiElementValues() ) ); + connect( mHtml, &QgsComposerMultiFrame::changed, this, &QgsComposerHtmlWidget::setGuiElementValues ); } //embed widget for general options diff --git a/src/app/composer/qgscomposerimageexportoptionsdialog.cpp b/src/app/composer/qgscomposerimageexportoptionsdialog.cpp index 3793709ed76..e89f57e39a8 100644 --- a/src/app/composer/qgscomposerimageexportoptionsdialog.cpp +++ b/src/app/composer/qgscomposerimageexportoptionsdialog.cpp @@ -27,7 +27,7 @@ QgsComposerImageExportOptionsDialog::QgsComposerImageExportOptionsDialog( QWidge { setupUi( this ); - connect( mClipToContentGroupBox, SIGNAL( toggled( bool ) ), this, SLOT( clipToContentsToggled( bool ) ) ); + connect( mClipToContentGroupBox, &QGroupBox::toggled, this, &QgsComposerImageExportOptionsDialog::clipToContentsToggled ); QgsSettings settings; restoreGeometry( settings.value( QStringLiteral( "Windows/ComposerImageExportOptionsDialog/geometry" ) ).toByteArray() ); diff --git a/src/app/composer/qgscomposeritemwidget.cpp b/src/app/composer/qgscomposeritemwidget.cpp index 5d620e76354..ad6c27b4ee2 100644 --- a/src/app/composer/qgscomposeritemwidget.cpp +++ b/src/app/composer/qgscomposeritemwidget.cpp @@ -24,6 +24,7 @@ #include "qgspropertyoverridebutton.h" #include "qgsexpressioncontext.h" #include "qgsproject.h" +#include "qgsvectorlayer.h" #include #include @@ -34,9 +35,9 @@ QgsComposerConfigObject::QgsComposerConfigObject( QWidget *parent, QgsComposerOb : QObject( parent ) , mComposerObject( composerObject ) { - connect( atlasComposition(), SIGNAL( coverageLayerChanged( QgsVectorLayer * ) ), - this, SLOT( updateDataDefinedButtons() ) ); - connect( atlasComposition(), SIGNAL( toggled( bool ) ), this, SLOT( updateDataDefinedButtons() ) ); + connect( atlasComposition(), &QgsAtlasComposition::coverageLayerChanged, + this, [ = ] { updateDataDefinedButtons(); } ); + connect( atlasComposition(), &QgsAtlasComposition::toggled, this, &QgsComposerConfigObject::updateDataDefinedButtons ); } QgsComposerConfigObject::~QgsComposerConfigObject() @@ -165,20 +166,20 @@ QgsComposerItemWidget::QgsComposerItemWidget( QWidget *parent, QgsComposerItem * initializeDataDefinedButtons(); setValuesForGuiElements(); - connect( mItem->composition(), SIGNAL( paperSizeChanged() ), this, SLOT( setValuesForGuiPositionElements() ) ); - connect( mItem, SIGNAL( sizeChanged() ), this, SLOT( setValuesForGuiPositionElements() ) ); - connect( mItem, SIGNAL( itemChanged() ), this, SLOT( setValuesForGuiNonPositionElements() ) ); + connect( mItem->composition(), &QgsComposition::paperSizeChanged, this, &QgsComposerItemWidget::setValuesForGuiPositionElements ); + connect( mItem, &QgsComposerItem::sizeChanged, this, &QgsComposerItemWidget::setValuesForGuiPositionElements ); + connect( mItem, &QgsComposerObject::itemChanged, this, &QgsComposerItemWidget::setValuesForGuiNonPositionElements ); - connect( mTransparencySlider, SIGNAL( valueChanged( int ) ), mTransparencySpnBx, SLOT( setValue( int ) ) ); + connect( mTransparencySlider, &QAbstractSlider::valueChanged, mTransparencySpnBx, &QSpinBox::setValue ); updateVariables(); - connect( mVariableEditor, SIGNAL( scopeChanged() ), this, SLOT( variablesChanged() ) ); + connect( mVariableEditor, &QgsVariableEditorWidget::scopeChanged, this, &QgsComposerItemWidget::variablesChanged ); // listen out for variable edits connect( QgsApplication::instance(), &QgsApplication::customVariablesChanged, this, &QgsComposerItemWidget::updateVariables ); connect( QgsProject::instance(), &QgsProject::customVariablesChanged, this, &QgsComposerItemWidget::updateVariables ); if ( mItem->composition() ) - connect( mItem->composition(), SIGNAL( variablesChanged() ), this, SLOT( updateVariables() ) ); + connect( mItem->composition(), &QgsComposition::variablesChanged, this, &QgsComposerItemWidget::updateVariables ); } QgsComposerItemWidget::~QgsComposerItemWidget() diff --git a/src/app/composer/qgscomposerlabelwidget.cpp b/src/app/composer/qgscomposerlabelwidget.cpp index ef1a0f1fb7b..2afce2f58e0 100644 --- a/src/app/composer/qgscomposerlabelwidget.cpp +++ b/src/app/composer/qgscomposerlabelwidget.cpp @@ -44,7 +44,7 @@ QgsComposerLabelWidget::QgsComposerLabelWidget( QgsComposerLabel *label ): QgsCo if ( mComposerLabel ) { setGuiElementValues(); - connect( mComposerLabel, SIGNAL( itemChanged() ), this, SLOT( setGuiElementValues() ) ); + connect( mComposerLabel, &QgsComposerObject::itemChanged, this, &QgsComposerLabelWidget::setGuiElementValues ); } } diff --git a/src/app/composer/qgscomposerlegendwidget.cpp b/src/app/composer/qgscomposerlegendwidget.cpp index 0a2c95f7f24..e0994f49e7e 100644 --- a/src/app/composer/qgscomposerlegendwidget.cpp +++ b/src/app/composer/qgscomposerlegendwidget.cpp @@ -81,7 +81,7 @@ QgsComposerLegendWidget::QgsComposerLegendWidget( QgsComposerLegend *legend ) if ( legend ) mMapComboBox->setComposition( legend->composition() ); mMapComboBox->setItemType( QgsComposerItem::ComposerMap ); - connect( mMapComboBox, SIGNAL( itemChanged( QgsComposerItem * ) ), this, SLOT( composerMapChanged( QgsComposerItem * ) ) ); + connect( mMapComboBox, &QgsComposerItemComboBox::itemChanged, this, &QgsComposerLegendWidget::composerMapChanged ); //add widget for item properties QgsComposerItemWidget *itemPropertiesWidget = new QgsComposerItemWidget( this, legend ); @@ -93,12 +93,12 @@ QgsComposerLegendWidget::QgsComposerLegendWidget( QgsComposerLegend *legend ) { mItemTreeView->setModel( legend->model() ); mItemTreeView->setMenuProvider( new QgsComposerLegendMenuProvider( mItemTreeView, this ) ); - connect( legend, SIGNAL( itemChanged() ), this, SLOT( setGuiElements() ) ); + connect( legend, &QgsComposerObject::itemChanged, this, &QgsComposerLegendWidget::setGuiElements ); mWrapCharLineEdit->setText( legend->wrapChar() ); // connect atlas state to the filter legend by atlas checkbox - connect( &legend->composition()->atlasComposition(), SIGNAL( toggled( bool ) ), this, SLOT( updateFilterLegendByAtlasButton() ) ); - connect( &legend->composition()->atlasComposition(), SIGNAL( coverageLayerChanged( QgsVectorLayer * ) ), this, SLOT( updateFilterLegendByAtlasButton() ) ); + connect( &legend->composition()->atlasComposition(), &QgsAtlasComposition::toggled, this, &QgsComposerLegendWidget::updateFilterLegendByAtlasButton ); + connect( &legend->composition()->atlasComposition(), &QgsAtlasComposition::coverageLayerChanged, this, &QgsComposerLegendWidget::updateFilterLegendByAtlasButton ); } registerDataDefinedButton( mLegendTitleDDBtn, QgsComposerObject::LegendTitle ); @@ -106,8 +106,8 @@ QgsComposerLegendWidget::QgsComposerLegendWidget( QgsComposerLegend *legend ) setGuiElements(); - connect( mItemTreeView->selectionModel(), SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), - this, SLOT( selectedChanged( const QModelIndex &, const QModelIndex & ) ) ); + connect( mItemTreeView->selectionModel(), &QItemSelectionModel::currentChanged, + this, &QgsComposerLegendWidget::selectedChanged ); } QgsComposerLegendWidget::QgsComposerLegendWidget(): QgsComposerItemBaseWidget( nullptr, nullptr ), mLegend( nullptr ) diff --git a/src/app/composer/qgscomposermapgridwidget.cpp b/src/app/composer/qgscomposermapgridwidget.cpp index fcaddb97bc6..563603b9caa 100644 --- a/src/app/composer/qgscomposermapgridwidget.cpp +++ b/src/app/composer/qgscomposermapgridwidget.cpp @@ -665,8 +665,8 @@ void QgsComposerMapGridWidget::on_mGridMarkerStyleButton_clicked() symbolContext.setExpressionContext( &context ); d->setContext( symbolContext ); - connect( d, SIGNAL( widgetChanged() ), this, SLOT( updateGridMarkerStyleFromWidget() ) ); - connect( d, SIGNAL( panelAccepted( QgsPanelWidget * ) ), this, SLOT( cleanUpGridMarkerStyleSelector( QgsPanelWidget * ) ) ); + connect( d, &QgsPanelWidget::widgetChanged, this, &QgsComposerMapGridWidget::updateGridMarkerStyleFromWidget ); + connect( d, &QgsPanelWidget::panelAccepted, this, &QgsComposerMapGridWidget::cleanUpGridMarkerStyleSelector ); openPanel( d ); mComposerMap->beginCommand( tr( "Grid markers style changed" ) ); } diff --git a/src/app/composer/qgscomposermapwidget.cpp b/src/app/composer/qgscomposermapwidget.cpp index 5019679d92e..5115bcd08e5 100644 --- a/src/app/composer/qgscomposermapwidget.cpp +++ b/src/app/composer/qgscomposermapwidget.cpp @@ -69,9 +69,9 @@ QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap *composerMap ) // follow preset combo mFollowVisibilityPresetCombo->setModel( new QStringListModel( mFollowVisibilityPresetCombo ) ); - connect( mFollowVisibilityPresetCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( followVisibilityPresetSelected( int ) ) ); - connect( QgsProject::instance()->mapThemeCollection(), SIGNAL( mapThemesChanged() ), - this, SLOT( onMapThemesChanged() ) ); + connect( mFollowVisibilityPresetCombo, static_cast( &QComboBox::currentIndexChanged ), this, &QgsComposerMapWidget::followVisibilityPresetSelected ); + connect( QgsProject::instance()->mapThemeCollection(), &QgsMapThemeCollection::mapThemesChanged, + this, &QgsComposerMapWidget::onMapThemesChanged ); onMapThemesChanged(); // keep layers from preset button @@ -79,20 +79,20 @@ QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap *composerMap ) mLayerListFromPresetButton->setMenu( menuKeepLayers ); mLayerListFromPresetButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionShowAllLayers.svg" ) ) ); mLayerListFromPresetButton->setToolTip( tr( "Set layer list from a map theme" ) ); - connect( menuKeepLayers, SIGNAL( aboutToShow() ), this, SLOT( aboutToShowKeepLayersVisibilityPresetsMenu() ) ); + connect( menuKeepLayers, &QMenu::aboutToShow, this, &QgsComposerMapWidget::aboutToShowKeepLayersVisibilityPresetsMenu ); if ( composerMap ) { mLabel->setText( tr( "Map %1" ).arg( composerMap->id() ) ); - connect( composerMap, SIGNAL( itemChanged() ), this, SLOT( setGuiElementValues() ) ); + connect( composerMap, &QgsComposerObject::itemChanged, this, &QgsComposerMapWidget::setGuiElementValues ); QgsAtlasComposition *atlas = atlasComposition(); if ( atlas ) { - connect( atlas, SIGNAL( coverageLayerChanged( QgsVectorLayer * ) ), - this, SLOT( atlasLayerChanged( QgsVectorLayer * ) ) ); - connect( atlas, SIGNAL( toggled( bool ) ), this, SLOT( compositionAtlasToggled( bool ) ) ); + connect( atlas, &QgsAtlasComposition::coverageLayerChanged, + this, &QgsComposerMapWidget::atlasLayerChanged ); + connect( atlas, &QgsAtlasComposition::toggled, this, &QgsComposerMapWidget::compositionAtlasToggled ); compositionAtlasToggled( atlas->enabled() ); } @@ -100,7 +100,7 @@ QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap *composerMap ) mOverviewFrameMapComboBox->setComposition( composerMap->composition() ); mOverviewFrameMapComboBox->setItemType( QgsComposerItem::ComposerMap ); mOverviewFrameMapComboBox->setExceptedItemList( QList< QgsComposerItem * >() << composerMap ); - connect( mOverviewFrameMapComboBox, SIGNAL( itemChanged( QgsComposerItem * ) ), this, SLOT( overviewMapChanged( QgsComposerItem * ) ) ); + connect( mOverviewFrameMapComboBox, &QgsComposerItemComboBox::itemChanged, this, &QgsComposerMapWidget::overviewMapChanged ); } connect( mCrsSelector, &QgsProjectionSelectionWidget::crsChanged, this, &QgsComposerMapWidget::mapCrsChanged ); @@ -1655,7 +1655,7 @@ void QgsComposerMapWidget::on_mOverviewFrameStyleButton_clicked() symbolContext.setExpressionContext( &context ); d->setContext( symbolContext ); - connect( d, SIGNAL( widgetChanged() ), this, SLOT( updateOverviewFrameStyleFromWidget() ) ); + connect( d, &QgsPanelWidget::widgetChanged, this, &QgsComposerMapWidget::updateOverviewFrameStyleFromWidget ); connect( d, &QgsPanelWidget::panelAccepted, this, &QgsComposerMapWidget::cleanUpOverviewFrameStyleSelector ); openPanel( d ); mComposerMap->beginCommand( tr( "Overview frame style changed" ) ); diff --git a/src/app/composer/qgscomposerpicturewidget.cpp b/src/app/composer/qgscomposerpicturewidget.cpp index d23d5864ccf..34b2086cc47 100644 --- a/src/app/composer/qgscomposerpicturewidget.cpp +++ b/src/app/composer/qgscomposerpicturewidget.cpp @@ -61,7 +61,7 @@ QgsComposerPictureWidget::QgsComposerPictureWidget( QgsComposerPicture *picture { mComposerMapComboBox->setComposition( mPicture->composition() ); mComposerMapComboBox->setItemType( QgsComposerItem::ComposerMap ); - connect( mComposerMapComboBox, SIGNAL( itemChanged( QgsComposerItem * ) ), this, SLOT( composerMapChanged( QgsComposerItem * ) ) ); + connect( mComposerMapComboBox, &QgsComposerItemComboBox::itemChanged, this, &QgsComposerPictureWidget::composerMapChanged ); } setGuiElementValues(); @@ -72,10 +72,10 @@ QgsComposerPictureWidget::QgsComposerPictureWidget( QgsComposerPicture *picture // mSearchDirectoriesGroupBox is a QgsCollapsibleGroupBoxBasic, so its collapsed state should not be saved/restored mSearchDirectoriesGroupBox->setCollapsed( true ); // setup connection for loading previews on first expansion of group box - connect( mSearchDirectoriesGroupBox, SIGNAL( collapsedStateChanged( bool ) ), this, SLOT( loadPicturePreviews( bool ) ) ); + connect( mSearchDirectoriesGroupBox, &QgsCollapsibleGroupBoxBasic::collapsedStateChanged, this, &QgsComposerPictureWidget::loadPicturePreviews ); - connect( mPicture, SIGNAL( itemChanged() ), this, SLOT( setGuiElementValues() ) ); - connect( mPicture, SIGNAL( pictureRotationChanged( double ) ), this, SLOT( setPicRotationSpinValue( double ) ) ); + connect( mPicture, &QgsComposerObject::itemChanged, this, &QgsComposerPictureWidget::setGuiElementValues ); + connect( mPicture, &QgsComposerPicture::pictureRotationChanged, this, &QgsComposerPictureWidget::setPicRotationSpinValue ); //connections for data defined buttons connect( mSourceDDBtn, &QgsPropertyOverrideButton::activated, mPictureLineEdit, &QLineEdit::setDisabled ); diff --git a/src/app/composer/qgscomposerpolygonwidget.cpp b/src/app/composer/qgscomposerpolygonwidget.cpp index 049812e56d0..d1393eec2d4 100644 --- a/src/app/composer/qgscomposerpolygonwidget.cpp +++ b/src/app/composer/qgscomposerpolygonwidget.cpp @@ -41,7 +41,7 @@ QgsComposerPolygonWidget::QgsComposerPolygonWidget( QgsComposerPolygon *composer if ( mComposerPolygon ) { - connect( mComposerPolygon, SIGNAL( itemChanged() ), this, SLOT( setGuiElementValues() ) ); + connect( mComposerPolygon, &QgsComposerObject::itemChanged, this, &QgsComposerPolygonWidget::setGuiElementValues ); } } @@ -67,7 +67,7 @@ void QgsComposerPolygonWidget::on_mPolygonStyleButton_clicked() symbolContext.setExpressionContext( &context ); d->setContext( symbolContext ); - connect( d, SIGNAL( widgetChanged() ), this, SLOT( updateStyleFromWidget() ) ); + connect( d, &QgsPanelWidget::widgetChanged, this, &QgsComposerPolygonWidget::updateStyleFromWidget ); connect( d, &QgsPanelWidget::panelAccepted, this, &QgsComposerPolygonWidget::cleanUpStyleSelector ); openPanel( d ); mComposerPolygon->beginCommand( tr( "Polygon style changed" ) ); diff --git a/src/app/composer/qgscomposerpolylinewidget.cpp b/src/app/composer/qgscomposerpolylinewidget.cpp index 796336f7688..43f0f2bbf12 100644 --- a/src/app/composer/qgscomposerpolylinewidget.cpp +++ b/src/app/composer/qgscomposerpolylinewidget.cpp @@ -39,7 +39,7 @@ QgsComposerPolylineWidget::QgsComposerPolylineWidget( QgsComposerPolyline *compo updatePolylineStyle(); if ( mComposerPolyline ) - connect( mComposerPolyline, SIGNAL( itemChanged() ), this, SLOT( setGuiElementValues() ) ); + connect( mComposerPolyline, &QgsComposerObject::itemChanged, this, &QgsComposerPolylineWidget::setGuiElementValues ); } QgsComposerPolylineWidget::~QgsComposerPolylineWidget() @@ -62,7 +62,7 @@ void QgsComposerPolylineWidget::on_mLineStyleButton_clicked() symbolContext.setExpressionContext( &context ); d->setContext( symbolContext ); - connect( d, SIGNAL( widgetChanged() ), this, SLOT( updateStyleFromWidget() ) ); + connect( d, &QgsPanelWidget::widgetChanged, this, &QgsComposerPolylineWidget::updateStyleFromWidget ); connect( d, &QgsPanelWidget::panelAccepted, this, &QgsComposerPolylineWidget::cleanUpStyleSelector ); openPanel( d ); mComposerPolyline->beginCommand( tr( "Polyline style changed" ) ); diff --git a/src/app/composer/qgscomposerscalebarwidget.cpp b/src/app/composer/qgscomposerscalebarwidget.cpp index c3cc4fbf19d..0201c60972b 100644 --- a/src/app/composer/qgscomposerscalebarwidget.cpp +++ b/src/app/composer/qgscomposerscalebarwidget.cpp @@ -37,7 +37,7 @@ QgsComposerScaleBarWidget::QgsComposerScaleBarWidget( QgsComposerScaleBar *scale mSegmentSizeRadioGroup.addButton( mFixedSizeRadio ); mSegmentSizeRadioGroup.addButton( mFitWidthRadio ); - connect( &mSegmentSizeRadioGroup, SIGNAL( buttonClicked( QAbstractButton * ) ), this, SLOT( segmentSizeRadioChanged( QAbstractButton * ) ) ); + connect( &mSegmentSizeRadioGroup, static_cast < void ( QButtonGroup::* )( QAbstractButton * ) > ( &QButtonGroup::buttonClicked ), this, &QgsComposerScaleBarWidget::segmentSizeRadioChanged ); blockMemberSignals( true ); @@ -89,7 +89,7 @@ QgsComposerScaleBarWidget::QgsComposerScaleBarWidget( QgsComposerScaleBar *scale mMapItemComboBox->setItemType( QgsComposerItem::ComposerMap ); } - connect( mMapItemComboBox, SIGNAL( itemChanged( QgsComposerItem * ) ), this, SLOT( composerMapChanged( QgsComposerItem * ) ) ); + connect( mMapItemComboBox, &QgsComposerItemComboBox::itemChanged, this, &QgsComposerScaleBarWidget::composerMapChanged ); registerDataDefinedButton( mFillColorDDBtn, QgsComposerObject::ScalebarFillColor ); registerDataDefinedButton( mFillColor2DDBtn, QgsComposerObject::ScalebarFillColor2 ); @@ -567,7 +567,7 @@ void QgsComposerScaleBarWidget::connectUpdateSignal() { if ( mComposerScaleBar ) { - QObject::connect( mComposerScaleBar, SIGNAL( itemChanged() ), this, SLOT( setGuiElements() ) ); + connect( mComposerScaleBar, &QgsComposerObject::itemChanged, this, &QgsComposerScaleBarWidget::setGuiElements ); } } @@ -575,7 +575,7 @@ void QgsComposerScaleBarWidget::disconnectUpdateSignal() { if ( mComposerScaleBar ) { - QObject::disconnect( mComposerScaleBar, SIGNAL( itemChanged() ), this, SLOT( setGuiElements() ) ); + disconnect( mComposerScaleBar, &QgsComposerObject::itemChanged, this, &QgsComposerScaleBarWidget::setGuiElements ); } } diff --git a/src/app/composer/qgscomposershapewidget.cpp b/src/app/composer/qgscomposershapewidget.cpp index ab90f8f82f7..c41874f0bbc 100644 --- a/src/app/composer/qgscomposershapewidget.cpp +++ b/src/app/composer/qgscomposershapewidget.cpp @@ -51,7 +51,7 @@ QgsComposerShapeWidget::QgsComposerShapeWidget( QgsComposerShape *composerShape if ( mComposerShape ) { - connect( mComposerShape, SIGNAL( itemChanged() ), this, SLOT( setGuiElementValues() ) ); + connect( mComposerShape, &QgsComposerObject::itemChanged, this, &QgsComposerShapeWidget::setGuiElementValues ); } } @@ -116,7 +116,7 @@ void QgsComposerShapeWidget::on_mShapeStyleButton_clicked() symbolContext.setExpressionContext( &context ); d->setContext( symbolContext ); - connect( d, SIGNAL( widgetChanged() ), this, SLOT( updateSymbolFromWidget() ) ); + connect( d, &QgsPanelWidget::widgetChanged, this, &QgsComposerShapeWidget::updateSymbolFromWidget ); connect( d, &QgsPanelWidget::panelAccepted, this, &QgsComposerShapeWidget::cleanUpSymbolSelector ); openPanel( d ); mComposerShape->beginCommand( tr( "Shape style changed" ) ); diff --git a/src/app/composer/qgscomposertablebackgroundcolorsdialog.cpp b/src/app/composer/qgscomposertablebackgroundcolorsdialog.cpp index 1e3309d5560..e02143d71e0 100644 --- a/src/app/composer/qgscomposertablebackgroundcolorsdialog.cpp +++ b/src/app/composer/qgscomposertablebackgroundcolorsdialog.cpp @@ -49,7 +49,7 @@ QgsComposerTableBackgroundColorsDialog::QgsComposerTableBackgroundColorsDialog( mColorButtonMap.insert( QgsComposerTableV2::FirstRow, mFirstRowColorButton ); mColorButtonMap.insert( QgsComposerTableV2::LastRow, mLastRowColorButton ); - connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) ); + connect( buttonBox->button( QDialogButtonBox::Apply ), &QAbstractButton::clicked, this, &QgsComposerTableBackgroundColorsDialog::apply ); QgsSettings settings; restoreGeometry( settings.value( QStringLiteral( "Windows/ComposerTableBackgroundColorsDialog/geometry" ) ).toByteArray() ); diff --git a/src/app/composer/qgscompositionwidget.cpp b/src/app/composer/qgscompositionwidget.cpp index 93a965d2a1a..47ba2e2e67c 100644 --- a/src/app/composer/qgscompositionwidget.cpp +++ b/src/app/composer/qgscompositionwidget.cpp @@ -24,6 +24,7 @@ #include "qgssymbollayerutils.h" #include "qgsexpressioncontext.h" #include "qgsproject.h" +#include "qgsvectorlayer.h" #include #include #include //for screen resolution @@ -50,7 +51,7 @@ QgsCompositionWidget::QgsCompositionWidget( QWidget *parent, QgsComposition *c ) displayCompositionWidthHeight(); updateVariables(); - connect( mVariableEditor, SIGNAL( scopeChanged() ), this, SLOT( variablesChanged() ) ); + connect( mVariableEditor, &QgsVariableEditorWidget::scopeChanged, this, &QgsCompositionWidget::variablesChanged ); // listen out for variable edits connect( QgsApplication::instance(), &QgsApplication::customVariablesChanged, this, &QgsCompositionWidget::updateVariables ); connect( QgsProject::instance(), &QgsProject::customVariablesChanged, this, &QgsCompositionWidget::updateVariables ); @@ -58,7 +59,7 @@ QgsCompositionWidget::QgsCompositionWidget( QWidget *parent, QgsComposition *c ) if ( mComposition ) { mNumPagesSpinBox->setValue( mComposition->numPages() ); - connect( mComposition, SIGNAL( nPagesChanged() ), this, SLOT( setNumberPages() ) ); + connect( mComposition, &QgsComposition::nPagesChanged, this, &QgsCompositionWidget::setNumberPages ); updatePageStyle(); @@ -97,16 +98,16 @@ QgsCompositionWidget::QgsCompositionWidget( QWidget *parent, QgsComposition *c ) if ( atlas ) { // repopulate data defined buttons if atlas layer changes - connect( atlas, SIGNAL( coverageLayerChanged( QgsVectorLayer * ) ), - this, SLOT( populateDataDefinedButtons() ) ); - connect( atlas, SIGNAL( toggled( bool ) ), this, SLOT( populateDataDefinedButtons() ) ); + connect( atlas, &QgsAtlasComposition::coverageLayerChanged, + this, [ = ] { populateDataDefinedButtons(); } ); + connect( atlas, &QgsAtlasComposition::toggled, this, &QgsCompositionWidget::populateDataDefinedButtons ); } } - connect( mTopMarginSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( resizeMarginsChanged() ) ); - connect( mRightMarginSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( resizeMarginsChanged() ) ); - connect( mBottomMarginSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( resizeMarginsChanged() ) ); - connect( mLeftMarginSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( resizeMarginsChanged() ) ); + connect( mTopMarginSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsCompositionWidget::resizeMarginsChanged ); + connect( mRightMarginSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsCompositionWidget::resizeMarginsChanged ); + connect( mBottomMarginSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsCompositionWidget::resizeMarginsChanged ); + connect( mLeftMarginSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsCompositionWidget::resizeMarginsChanged ); connect( mPaperSizeDDBtn, &QgsPropertyOverrideButton::activated, mPaperSizeComboBox, &QComboBox::setDisabled ); connect( mPaperWidthDDBtn, &QgsPropertyOverrideButton::activated, mPaperWidthDoubleSpinBox, &QgsDoubleSpinBox::setDisabled ); @@ -547,7 +548,7 @@ void QgsCompositionWidget::on_mPageStyleButton_clicked() symbolContext.setExpressionContext( &context ); d->setContext( symbolContext ); - connect( d, SIGNAL( widgetChanged() ), this, SLOT( updateStyleFromWidget() ) ); + connect( d, &QgsPanelWidget::widgetChanged, this, &QgsCompositionWidget::updateStyleFromWidget ); connect( d, &QgsPanelWidget::panelAccepted, this, &QgsCompositionWidget::cleanUpStyleSelector ); openPanel( d ); } diff --git a/src/app/gps/qgsgpsinformationwidget.cpp b/src/app/gps/qgsgpsinformationwidget.cpp index a5fb4861ba4..196f7ffa217 100644 --- a/src/app/gps/qgsgpsinformationwidget.cpp +++ b/src/app/gps/qgsgpsinformationwidget.cpp @@ -241,8 +241,8 @@ QgsGPSInformationWidget::QgsGPSInformationWidget( QgsMapCanvas *thepCanvas, QWid //SLM - added functionality mLogFile = nullptr; - connect( QgisApp::instance()->layerTreeView(), SIGNAL( currentLayerChanged( QgsMapLayer * ) ), - this, SLOT( updateCloseFeatureButton( QgsMapLayer * ) ) ); + connect( QgisApp::instance()->layerTreeView(), &QgsLayerTreeView::currentLayerChanged, + this, &QgsGPSInformationWidget::updateCloseFeatureButton ); mStackedWidget->setCurrentIndex( 3 ); // force to Options mBtnPosition->setFocus( Qt::TabFocusReason ); @@ -423,8 +423,8 @@ void QgsGPSInformationWidget::connectGps() showStatusBarMessage( tr( "Connecting to GPS device..." ) ); QgsGPSDetector *detector = new QgsGPSDetector( port ); - connect( detector, SIGNAL( detected( QgsGPSConnection * ) ), this, SLOT( connected( QgsGPSConnection * ) ) ); - connect( detector, SIGNAL( detectionFailed() ), this, SLOT( timedout() ) ); + connect( detector, static_cast < void ( QgsGPSDetector::* )( QgsGPSConnection * ) > ( &QgsGPSDetector::detected ), this, &QgsGPSInformationWidget::connected ); + connect( detector, &QgsGPSDetector::detectionFailed, this, &QgsGPSInformationWidget::timedout ); detector->advance(); // start the detection process } @@ -439,8 +439,8 @@ void QgsGPSInformationWidget::timedout() void QgsGPSInformationWidget::connected( QgsGPSConnection *conn ) { mNmea = conn; - connect( mNmea, SIGNAL( stateChanged( const QgsGPSInformation & ) ), - this, SLOT( displayGPSInformation( const QgsGPSInformation & ) ) ); + connect( mNmea, &QgsGPSConnection::stateChanged, + this, &QgsGPSInformationWidget::displayGPSInformation ); mGPSPlainTextEdit->appendPlainText( tr( "Connected!" ) ); mConnectButton->setText( tr( "Dis&connect" ) ); //insert connection into registry such that it can also be used by other dialogs or plugins @@ -461,7 +461,7 @@ void QgsGPSInformationWidget::connected( QgsGPSConnection *conn ) // crude way to separate chunks - use when manually editing file - NMEA parsers should discard mLogFileTextStream << "====" << "\r\n"; - connect( mNmea, SIGNAL( nmeaSentenceReceived( const QString & ) ), this, SLOT( logNmeaSentence( const QString & ) ) ); // added to handle raw data + connect( mNmea, &QgsGPSConnection::nmeaSentenceReceived, this, &QgsGPSInformationWidget::logNmeaSentence ); // added to handle raw data } else // error opening file { @@ -478,7 +478,7 @@ void QgsGPSInformationWidget::disconnectGps() { if ( mLogFile && mLogFile->isOpen() ) { - disconnect( mNmea, SIGNAL( nmeaSentenceReceived( const QString & ) ), this, SLOT( logNmeaSentence( const QString & ) ) ); + disconnect( mNmea, &QgsGPSConnection::nmeaSentenceReceived, this, &QgsGPSInformationWidget::logNmeaSentence ); mLogFile->close(); delete mLogFile; mLogFile = nullptr; @@ -980,8 +980,8 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked() void QgsGPSInformationWidget::connectGpsSlot() { - connect( mNmea, SIGNAL( stateChanged( const QgsGPSInformation & ) ), - this, SLOT( displayGPSInformation( const QgsGPSInformation & ) ) ); + connect( mNmea, &QgsGPSConnection::stateChanged, + this, &QgsGPSInformationWidget::displayGPSInformation ); } void QgsGPSInformationWidget::on_mBtnRefreshDevices_clicked() @@ -1065,17 +1065,17 @@ void QgsGPSInformationWidget::updateCloseFeatureButton( QgsMapLayer *lyr ) { if ( mpLastLayer ) // disconnect previous layer { - disconnect( mpLastLayer, SIGNAL( editingStarted() ), - this, SLOT( layerEditStateChanged() ) ); - disconnect( mpLastLayer, SIGNAL( editingStopped() ), - this, SLOT( layerEditStateChanged() ) ); + disconnect( mpLastLayer, &QgsVectorLayer::editingStarted, + this, &QgsGPSInformationWidget::layerEditStateChanged ); + disconnect( mpLastLayer, &QgsVectorLayer::editingStopped, + this, &QgsGPSInformationWidget::layerEditStateChanged ); } if ( vlayer ) // connect new layer { - connect( vlayer, SIGNAL( editingStarted() ), - this, SLOT( layerEditStateChanged() ) ); - connect( vlayer, SIGNAL( editingStopped() ), - this, SLOT( layerEditStateChanged() ) ); + connect( vlayer, &QgsVectorLayer::editingStarted, + this, &QgsGPSInformationWidget::layerEditStateChanged ); + connect( vlayer, &QgsVectorLayer::editingStopped, + this, &QgsGPSInformationWidget::layerEditStateChanged ); } mpLastLayer = vlayer; } diff --git a/src/app/nodetool/qgsmaptoolnodetool.cpp b/src/app/nodetool/qgsmaptoolnodetool.cpp index b0282484bdd..cb70fa7d448 100644 --- a/src/app/nodetool/qgsmaptoolnodetool.cpp +++ b/src/app/nodetool/qgsmaptoolnodetool.cpp @@ -250,14 +250,14 @@ void QgsMapToolNodeTool::canvasPressEvent( QgsMapMouseEvent *e ) mSelectedFeature = new QgsSelectedFeature( snapResults[0].snappedAtGeometry, vlayer, mCanvas ); updateSelectFeature(); } - connect( QgisApp::instance()->layerTreeView(), SIGNAL( currentLayerChanged( QgsMapLayer * ) ), this, SLOT( currentLayerChanged( QgsMapLayer * ) ) ); - connect( mSelectedFeature, SIGNAL( destroyed() ), this, SLOT( selectedFeatureDestroyed() ) ); - connect( vlayer, SIGNAL( geometryChanged( QgsFeatureId, const QgsGeometry & ) ), this, SLOT( geometryChanged( QgsFeatureId, const QgsGeometry & ) ) ); - connect( vlayer, SIGNAL( editingStopped() ), this, SLOT( editingToggled() ) ); + connect( QgisApp::instance()->layerTreeView(), &QgsLayerTreeView::currentLayerChanged, this, &QgsMapToolNodeTool::currentLayerChanged ); + connect( mSelectedFeature, &QObject::destroyed, this, &QgsMapToolNodeTool::selectedFeatureDestroyed ); + connect( vlayer, &QgsVectorLayer::geometryChanged, this, &QgsMapToolNodeTool::geometryChanged ); + connect( vlayer, &QgsVectorLayer::editingStopped, this, &QgsMapToolNodeTool::editingToggled ); mIsPoint = vlayer->geometryType() == QgsWkbTypes::PointGeometry; mNodeEditor = new QgsNodeEditor( vlayer, mSelectedFeature, mCanvas ); QgisApp::instance()->addDockWidget( Qt::LeftDockWidgetArea, mNodeEditor ); - connect( mNodeEditor, SIGNAL( deleteSelectedRequested() ), this, SLOT( deleteNodeSelection() ) ); + connect( mNodeEditor, &QgsNodeEditor::deleteSelectedRequested, this, &QgsMapToolNodeTool::deleteNodeSelection ); } else { @@ -581,9 +581,9 @@ void QgsMapToolNodeTool::cleanTool( bool deleteSelectedFeature ) QgsVectorLayer *vlayer = mSelectedFeature->vlayer(); Q_ASSERT( vlayer ); - disconnect( QgisApp::instance()->layerTreeView(), SIGNAL( currentLayerChanged( QgsMapLayer * ) ), this, SLOT( currentLayerChanged( QgsMapLayer * ) ) ); - disconnect( mSelectedFeature, SIGNAL( destroyed() ), this, SLOT( selectedFeatureDestroyed() ) ); - disconnect( vlayer, SIGNAL( editingStopped() ), this, SLOT( editingToggled() ) ); + disconnect( QgisApp::instance()->layerTreeView(), &QgsLayerTreeView::currentLayerChanged, this, &QgsMapToolNodeTool::currentLayerChanged ); + disconnect( mSelectedFeature, &QObject::destroyed, this, &QgsMapToolNodeTool::selectedFeatureDestroyed ); + disconnect( vlayer, &QgsVectorLayer::editingStopped, this, &QgsMapToolNodeTool::editingToggled ); if ( deleteSelectedFeature ) delete mSelectedFeature; diff --git a/src/app/nodetool/qgsnodeeditor.cpp b/src/app/nodetool/qgsnodeeditor.cpp index 4b28cd96702..ff39e3977c3 100644 --- a/src/app/nodetool/qgsnodeeditor.cpp +++ b/src/app/nodetool/qgsnodeeditor.cpp @@ -68,7 +68,7 @@ QgsNodeEditorModel::QgsNodeEditorModel( QgsVectorLayer *layer, QgsSelectedFeatur mWidgetFont = parentWidget->font(); } - connect( mSelectedFeature, SIGNAL( vertexMapChanged() ), this, SLOT( featureChanged() ) ); + connect( mSelectedFeature, &QgsSelectedFeature::vertexMapChanged, this, &QgsNodeEditorModel::featureChanged ); } int QgsNodeEditorModel::rowCount( const QModelIndex &parent ) const @@ -306,8 +306,8 @@ QgsNodeEditor::QgsNodeEditor( setWidget( mTableView ); - connect( mSelectedFeature, SIGNAL( selectionChanged() ), this, SLOT( updateTableSelection() ) ); - connect( mTableView->selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), this, SLOT( updateNodeSelection( QItemSelection, QItemSelection ) ) ); + connect( mSelectedFeature, &QgsSelectedFeature::selectionChanged, this, &QgsNodeEditor::updateTableSelection ); + connect( mTableView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &QgsNodeEditor::updateNodeSelection ); } void QgsNodeEditor::updateTableSelection() diff --git a/src/app/nodetool/qgsselectedfeature.cpp b/src/app/nodetool/qgsselectedfeature.cpp index 074f0c22daf..abc6f2783c6 100644 --- a/src/app/nodetool/qgsselectedfeature.cpp +++ b/src/app/nodetool/qgsselectedfeature.cpp @@ -94,27 +94,27 @@ void QgsSelectedFeature::setSelectedFeature( QgsFeatureId featureId, QgsVectorLa mGeometry = nullptr; // signal changing of current layer - connect( QgisApp::instance()->layerTreeView(), SIGNAL( currentLayerChanged( QgsMapLayer * ) ), this, SLOT( currentLayerChanged( QgsMapLayer * ) ) ); + connect( QgisApp::instance()->layerTreeView(), &QgsLayerTreeView::currentLayerChanged, this, &QgsSelectedFeature::currentLayerChanged ); // feature was deleted - connect( mVlayer, SIGNAL( featureDeleted( QgsFeatureId ) ), this, SLOT( featureDeleted( QgsFeatureId ) ) ); + connect( mVlayer, &QgsVectorLayer::featureDeleted, this, &QgsSelectedFeature::featureDeleted ); // rolling back - connect( mVlayer, SIGNAL( beforeRollBack() ), this, SLOT( beforeRollBack() ) ); + connect( mVlayer, &QgsVectorLayer::beforeRollBack, this, &QgsSelectedFeature::beforeRollBack ); // projection or extents changed - connect( canvas, SIGNAL( destinationCrsChanged() ), this, SLOT( updateVertexMarkersPosition() ) ); - connect( canvas, SIGNAL( extentsChanged() ), this, SLOT( updateVertexMarkersPosition() ) ); + connect( canvas, &QgsMapCanvas::destinationCrsChanged, this, &QgsSelectedFeature::updateVertexMarkersPosition ); + connect( canvas, &QgsMapCanvas::extentsChanged, this, &QgsSelectedFeature::updateVertexMarkersPosition ); // geometry was changed - connect( mVlayer, SIGNAL( geometryChanged( QgsFeatureId, const QgsGeometry & ) ), this, SLOT( geometryChanged( QgsFeatureId, const QgsGeometry & ) ) ); + connect( mVlayer, &QgsVectorLayer::geometryChanged, this, &QgsSelectedFeature::geometryChanged ); replaceVertexMap(); } void QgsSelectedFeature::beforeRollBack() { - disconnect( mVlayer, SIGNAL( geometryChanged( QgsFeatureId, const QgsGeometry & ) ), this, SLOT( geometryChanged( QgsFeatureId, const QgsGeometry & ) ) ); + disconnect( mVlayer, &QgsVectorLayer::geometryChanged, this, &QgsSelectedFeature::geometryChanged ); deleteVertexMap(); } @@ -123,7 +123,7 @@ void QgsSelectedFeature::beginGeometryChange() Q_ASSERT( !mChangingGeometry ); mChangingGeometry = true; - disconnect( mVlayer, SIGNAL( geometryChanged( QgsFeatureId, const QgsGeometry & ) ), this, SLOT( geometryChanged( QgsFeatureId, const QgsGeometry & ) ) ); + disconnect( mVlayer, &QgsVectorLayer::geometryChanged, this, &QgsSelectedFeature::geometryChanged ); } void QgsSelectedFeature::endGeometryChange() @@ -131,7 +131,7 @@ void QgsSelectedFeature::endGeometryChange() Q_ASSERT( mChangingGeometry ); mChangingGeometry = false; - connect( mVlayer, SIGNAL( geometryChanged( QgsFeatureId, const QgsGeometry & ) ), this, SLOT( geometryChanged( QgsFeatureId, const QgsGeometry & ) ) ); + connect( mVlayer, &QgsVectorLayer::geometryChanged, this, &QgsSelectedFeature::geometryChanged ); } void QgsSelectedFeature::canvasLayersChanged() @@ -185,8 +185,8 @@ void QgsSelectedFeature::validateGeometry( QgsGeometry *g ) } mValidator = new QgsGeometryValidator( g ); - connect( mValidator, SIGNAL( errorFound( QgsGeometry::Error ) ), this, SLOT( addError( QgsGeometry::Error ) ) ); - connect( mValidator, SIGNAL( finished() ), this, SLOT( validationFinished() ) ); + connect( mValidator, &QgsGeometryValidator::errorFound, this, &QgsSelectedFeature::addError ); + connect( mValidator, &QThread::finished, this, &QgsSelectedFeature::validationFinished ); mValidator->start(); QStatusBar *sb = QgisApp::instance()->statusBar(); diff --git a/src/app/openstreetmap/qgsosmdownloaddialog.cpp b/src/app/openstreetmap/qgsosmdownloaddialog.cpp index 7ec1ffd1f64..6d438ed521b 100644 --- a/src/app/openstreetmap/qgsosmdownloaddialog.cpp +++ b/src/app/openstreetmap/qgsosmdownloaddialog.cpp @@ -44,16 +44,16 @@ QgsOSMDownloadDialog::QgsOSMDownloadDialog( QWidget *parent ) populateLayers(); onExtentCanvas(); - connect( radExtentCanvas, SIGNAL( clicked() ), this, SLOT( onExtentCanvas() ) ); - connect( radExtentLayer, SIGNAL( clicked() ), this, SLOT( onExtentLayer() ) ); - connect( radExtentManual, SIGNAL( clicked() ), this, SLOT( onExtentManual() ) ); - connect( cboLayers, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onCurrentLayerChanged( int ) ) ); - connect( btnBrowse, SIGNAL( clicked() ), this, SLOT( onBrowseClicked() ) ); - connect( buttonBox, SIGNAL( accepted() ), this, SLOT( onOK() ) ); - connect( buttonBox, SIGNAL( rejected() ), this, SLOT( onClose() ) ); + connect( radExtentCanvas, &QAbstractButton::clicked, this, &QgsOSMDownloadDialog::onExtentCanvas ); + connect( radExtentLayer, &QAbstractButton::clicked, this, &QgsOSMDownloadDialog::onExtentLayer ); + connect( radExtentManual, &QAbstractButton::clicked, this, &QgsOSMDownloadDialog::onExtentManual ); + connect( cboLayers, static_cast( &QComboBox::currentIndexChanged ), this, &QgsOSMDownloadDialog::onCurrentLayerChanged ); + connect( btnBrowse, &QAbstractButton::clicked, this, &QgsOSMDownloadDialog::onBrowseClicked ); + connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsOSMDownloadDialog::onOK ); + connect( buttonBox, &QDialogButtonBox::rejected, this, &QgsOSMDownloadDialog::onClose ); - connect( mDownload, SIGNAL( finished() ), this, SLOT( onFinished() ) ); - connect( mDownload, SIGNAL( downloadProgress( qint64, qint64 ) ), this, SLOT( onDownloadProgress( qint64, qint64 ) ) ); + connect( mDownload, &QgsOSMDownload::finished, this, &QgsOSMDownloadDialog::onFinished ); + connect( mDownload, &QgsOSMDownload::downloadProgress, this, &QgsOSMDownloadDialog::onDownloadProgress ); } QgsOSMDownloadDialog::~QgsOSMDownloadDialog() diff --git a/src/app/openstreetmap/qgsosmexportdialog.cpp b/src/app/openstreetmap/qgsosmexportdialog.cpp index 748b262b0d2..74fa3d4a16d 100644 --- a/src/app/openstreetmap/qgsosmexportdialog.cpp +++ b/src/app/openstreetmap/qgsosmexportdialog.cpp @@ -33,16 +33,16 @@ QgsOSMExportDialog::QgsOSMExportDialog( QWidget *parent ) { setupUi( this ); - connect( btnBrowseDb, SIGNAL( clicked() ), this, SLOT( onBrowse() ) ); - connect( buttonBox, SIGNAL( accepted() ), this, SLOT( onOK() ) ); - connect( buttonBox, SIGNAL( rejected() ), this, SLOT( onClose() ) ); - connect( editDbFileName, SIGNAL( textChanged( QString ) ), this, SLOT( updateLayerName() ) ); - connect( radPoints, SIGNAL( clicked() ), this, SLOT( updateLayerName() ) ); - connect( radPolylines, SIGNAL( clicked() ), this, SLOT( updateLayerName() ) ); - connect( radPolygons, SIGNAL( clicked() ), this, SLOT( updateLayerName() ) ); - connect( btnLoadTags, SIGNAL( clicked() ), this, SLOT( onLoadTags() ) ); - connect( btnSelectAll, SIGNAL( clicked() ), this, SLOT( onSelectAll() ) ); - connect( btnDeselectAll, SIGNAL( clicked() ), this, SLOT( onDeselectAll() ) ); + connect( btnBrowseDb, &QAbstractButton::clicked, this, &QgsOSMExportDialog::onBrowse ); + connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsOSMExportDialog::onOK ); + connect( buttonBox, &QDialogButtonBox::rejected, this, &QgsOSMExportDialog::onClose ); + connect( editDbFileName, &QLineEdit::textChanged, this, &QgsOSMExportDialog::updateLayerName ); + connect( radPoints, &QAbstractButton::clicked, this, &QgsOSMExportDialog::updateLayerName ); + connect( radPolylines, &QAbstractButton::clicked, this, &QgsOSMExportDialog::updateLayerName ); + connect( radPolygons, &QAbstractButton::clicked, this, &QgsOSMExportDialog::updateLayerName ); + connect( btnLoadTags, &QAbstractButton::clicked, this, &QgsOSMExportDialog::onLoadTags ); + connect( btnSelectAll, &QAbstractButton::clicked, this, &QgsOSMExportDialog::onSelectAll ); + connect( btnDeselectAll, &QAbstractButton::clicked, this, &QgsOSMExportDialog::onDeselectAll ); mTagsModel = new QStandardItemModel( this ); mTagsModel->setHorizontalHeaderLabels( QStringList() << tr( "Tag" ) << tr( "Count" ) << tr( "Not null" ) ); diff --git a/src/app/openstreetmap/qgsosmimportdialog.cpp b/src/app/openstreetmap/qgsosmimportdialog.cpp index 9733f02cf67..cbf18f19877 100644 --- a/src/app/openstreetmap/qgsosmimportdialog.cpp +++ b/src/app/openstreetmap/qgsosmimportdialog.cpp @@ -28,14 +28,14 @@ QgsOSMImportDialog::QgsOSMImportDialog( QWidget *parent ) { setupUi( this ); - connect( btnBrowseXml, SIGNAL( clicked() ), this, SLOT( onBrowseXml() ) ); - connect( btnBrowseDb, SIGNAL( clicked() ), this, SLOT( onBrowseDb() ) ); - connect( editXmlFileName, SIGNAL( textChanged( const QString & ) ), this, SLOT( xmlFileNameChanged( const QString & ) ) ); - connect( editDbFileName, SIGNAL( textChanged( const QString & ) ), this, SLOT( dbFileNameChanged( const QString & ) ) ); - connect( buttonBox, SIGNAL( accepted() ), this, SLOT( onOK() ) ); - connect( buttonBox, SIGNAL( rejected() ), this, SLOT( onClose() ) ); + connect( btnBrowseXml, &QAbstractButton::clicked, this, &QgsOSMImportDialog::onBrowseXml ); + connect( btnBrowseDb, &QAbstractButton::clicked, this, &QgsOSMImportDialog::onBrowseDb ); + connect( editXmlFileName, &QLineEdit::textChanged, this, &QgsOSMImportDialog::xmlFileNameChanged ); + connect( editDbFileName, &QLineEdit::textChanged, this, &QgsOSMImportDialog::dbFileNameChanged ); + connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsOSMImportDialog::onOK ); + connect( buttonBox, &QDialogButtonBox::rejected, this, &QgsOSMImportDialog::onClose ); - connect( mImport, SIGNAL( progress( int ) ), this, SLOT( onProgress( int ) ) ); + connect( mImport, &QgsOSMXmlImport::progress, this, &QgsOSMImportDialog::onProgress ); } QgsOSMImportDialog::~QgsOSMImportDialog() diff --git a/src/app/pluginmanager/qgspluginmanager.cpp b/src/app/pluginmanager/qgspluginmanager.cpp index a3821eb8102..70111d13da5 100644 --- a/src/app/pluginmanager/qgspluginmanager.cpp +++ b/src/app/pluginmanager/qgspluginmanager.cpp @@ -106,9 +106,9 @@ QgsPluginManager::QgsPluginManager( QWidget *parent, bool pluginsAreEnabled, Qt: mOptionsListWidget->setCurrentRow( 0 ); // Connect other signals - connect( mOptionsListWidget, SIGNAL( currentRowChanged( int ) ), this, SLOT( setCurrentTab( int ) ) ); - connect( vwPlugins->selectionModel(), SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), this, SLOT( currentPluginChanged( const QModelIndex & ) ) ); - connect( mModelPlugins, SIGNAL( itemChanged( QStandardItem * ) ), this, SLOT( pluginItemChanged( QStandardItem * ) ) ); + connect( mOptionsListWidget, &QListWidget::currentRowChanged, this, &QgsPluginManager::setCurrentTab ); + connect( vwPlugins->selectionModel(), &QItemSelectionModel::currentChanged, this, &QgsPluginManager::currentPluginChanged ); + connect( mModelPlugins, &QStandardItemModel::itemChanged, this, &QgsPluginManager::pluginItemChanged ); // Force setting the status filter (if the active tab was 0, the setCurrentRow( 0 ) above doesn't take any action) setCurrentTab( 0 ); @@ -180,10 +180,10 @@ void QgsPluginManager::setPythonUtils( QgsPythonUtils *pythonUtils ) vwPlugins->addAction( actionSortByVote ); vwPlugins->addAction( actionSortByStatus ); vwPlugins->setContextMenuPolicy( Qt::ActionsContextMenu ); - connect( actionSortByName, SIGNAL( triggered() ), mModelProxy, SLOT( sortPluginsByName() ) ); - connect( actionSortByDownloads, SIGNAL( triggered() ), mModelProxy, SLOT( sortPluginsByDownloads() ) ); - connect( actionSortByVote, SIGNAL( triggered() ), mModelProxy, SLOT( sortPluginsByVote() ) ); - connect( actionSortByStatus, SIGNAL( triggered() ), mModelProxy, SLOT( sortPluginsByStatus() ) ); + connect( actionSortByName, &QAction::triggered, mModelProxy, &QgsPluginSortFilterProxyModel::sortPluginsByName ); + connect( actionSortByDownloads, &QAction::triggered, mModelProxy, &QgsPluginSortFilterProxyModel::sortPluginsByDownloads ); + connect( actionSortByVote, &QAction::triggered, mModelProxy, &QgsPluginSortFilterProxyModel::sortPluginsByVote ); + connect( actionSortByStatus, &QAction::triggered, mModelProxy, &QgsPluginSortFilterProxyModel::sortPluginsByStatus ); // get the QgsSettings group from the installer QString settingsGroup; @@ -1010,12 +1010,12 @@ void QgsPluginManager::addToRepositoryList( const QMap &reposi buttonRefreshRepos->setText( tr( "Reload all repositories" ) ); QAction *actionEnableThisRepositoryOnly = new QAction( tr( "Only show plugins from selected repository" ), treeRepositories ); treeRepositories->addAction( actionEnableThisRepositoryOnly ); - connect( actionEnableThisRepositoryOnly, SIGNAL( triggered() ), this, SLOT( setRepositoryFilter() ) ); + connect( actionEnableThisRepositoryOnly, &QAction::triggered, this, &QgsPluginManager::setRepositoryFilter ); treeRepositories->setContextMenuPolicy( Qt::ActionsContextMenu ); QAction *actionClearFilter = new QAction( tr( "Clear filter" ), treeRepositories ); actionClearFilter->setEnabled( repository.value( QStringLiteral( "inspection_filter" ) ) == QLatin1String( "true" ) ); treeRepositories->addAction( actionClearFilter ); - connect( actionClearFilter, SIGNAL( triggered() ), this, SLOT( clearRepositoryFilter() ) ); + connect( actionClearFilter, &QAction::triggered, this, &QgsPluginManager::clearRepositoryFilter ); } QString key = repository.value( QStringLiteral( "name" ) ); diff --git a/src/app/qgisappinterface.cpp b/src/app/qgisappinterface.cpp index 8c423e3a8ef..66023c3f222 100644 --- a/src/app/qgisappinterface.cpp +++ b/src/app/qgisappinterface.cpp @@ -51,21 +51,21 @@ QgisAppInterface::QgisAppInterface( QgisApp *_qgis ) , pluginManagerIface( _qgis->pluginManager() ) { // connect signals - connect( qgis->layerTreeView(), SIGNAL( currentLayerChanged( QgsMapLayer * ) ), - this, SIGNAL( currentLayerChanged( QgsMapLayer * ) ) ); - connect( qgis, SIGNAL( currentThemeChanged( QString ) ), - this, SIGNAL( currentThemeChanged( QString ) ) ); + connect( qgis->layerTreeView(), &QgsLayerTreeView::currentLayerChanged, + this, &QgisInterface::currentLayerChanged ); + connect( qgis, &QgisApp::currentThemeChanged, + this, &QgisAppInterface::currentThemeChanged ); connect( qgis, &QgisApp::composerOpened, this, &QgisAppInterface::composerOpened ); connect( qgis, &QgisApp::composerWillBeClosed, this, &QgisAppInterface::composerWillBeClosed ); connect( qgis, &QgisApp::composerClosed, this, &QgisAppInterface::composerClosed ); - connect( qgis, SIGNAL( initializationCompleted() ), - this, SIGNAL( initializationCompleted() ) ); - connect( qgis, SIGNAL( newProject() ), - this, SIGNAL( newProjectCreated() ) ); - connect( qgis, SIGNAL( projectRead() ), - this, SIGNAL( projectRead() ) ); - connect( qgis, SIGNAL( layerSavedAs( QgsMapLayer *, QString ) ), - this, SIGNAL( layerSavedAs( QgsMapLayer *, QString ) ) ); + connect( qgis, &QgisApp::initializationCompleted, + this, &QgisInterface::initializationCompleted ); + connect( qgis, &QgisApp::newProject, + this, &QgisInterface::newProjectCreated ); + connect( qgis, &QgisApp::projectRead, + this, &QgisInterface::projectRead ); + connect( qgis, &QgisApp::layerSavedAs, + this, &QgisInterface::layerSavedAs ); } QgsPluginManagerInterface *QgisAppInterface::pluginManagerInterface() diff --git a/src/app/qgsabout.cpp b/src/app/qgsabout.cpp index 507bbabdedf..13527481ea6 100644 --- a/src/app/qgsabout.cpp +++ b/src/app/qgsabout.cpp @@ -65,7 +65,7 @@ void QgsAbout::init() developersMapView->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks ); developersMapView->setContextMenuPolicy( Qt::NoContextMenu ); - connect( developersMapView, SIGNAL( linkClicked( const QUrl & ) ), this, SLOT( openUrl( const QUrl & ) ) ); + connect( developersMapView, &QWebView::linkClicked, this, &QgsAbout::openUrl ); // set the 60x60 icon pixmap qgisIcon->setPixmap( QPixmap( QgsApplication::appIconPath() ) ); diff --git a/src/app/qgsaddtaborgroup.cpp b/src/app/qgsaddtaborgroup.cpp index bbe3d08b512..ebaae7c85bd 100644 --- a/src/app/qgsaddtaborgroup.cpp +++ b/src/app/qgsaddtaborgroup.cpp @@ -49,8 +49,8 @@ QgsAddTabOrGroup::QgsAddTabOrGroup( QgsVectorLayer *lyr, const QList < TabPair > mGroupButton->setEnabled( false ); } - connect( mTabButton, SIGNAL( toggled( bool ) ), this, SLOT( on_mTabButton_toggled( bool ) ) ); - connect( mGroupButton, SIGNAL( toggled( bool ) ), this, SLOT( on_mGroupButton_toggled( bool ) ) ); + connect( mTabButton, &QAbstractButton::toggled, this, &QgsAddTabOrGroup::on_mTabButton_toggled ); + connect( mGroupButton, &QAbstractButton::toggled, this, &QgsAddTabOrGroup::on_mGroupButton_toggled ); mColumnCountSpinBox->setValue( QgsSettings().value( QStringLiteral( "/qgis/attributeForm/defaultTabColumnCount" ), 1 ).toInt() ); diff --git a/src/app/qgsalignrasterdialog.cpp b/src/app/qgsalignrasterdialog.cpp index 6bb27c13ab8..fd0eb2b95d1 100644 --- a/src/app/qgsalignrasterdialog.cpp +++ b/src/app/qgsalignrasterdialog.cpp @@ -83,31 +83,31 @@ QgsAlignRasterDialog::QgsAlignRasterDialog( QWidget *parent ) mAlign = new QgsAlignRaster; mAlign->setProgressHandler( new QgsAlignRasterDialogProgress( mProgress ) ); - connect( mBtnAdd, SIGNAL( clicked( bool ) ), this, SLOT( addLayer() ) ); - connect( mBtnRemove, SIGNAL( clicked( bool ) ), this, SLOT( removeLayer() ) ); - connect( mBtnEdit, SIGNAL( clicked( bool ) ), this, SLOT( editLayer() ) ); + connect( mBtnAdd, &QAbstractButton::clicked, this, &QgsAlignRasterDialog::addLayer ); + connect( mBtnRemove, &QAbstractButton::clicked, this, &QgsAlignRasterDialog::removeLayer ); + connect( mBtnEdit, &QAbstractButton::clicked, this, &QgsAlignRasterDialog::editLayer ); - connect( mCboReferenceLayer, SIGNAL( currentIndexChanged( int ) ), this, SLOT( referenceLayerChanged() ) ); - connect( mCrsSelector, SIGNAL( crsChanged( QgsCoordinateReferenceSystem ) ), this, SLOT( destinationCrsChanged() ) ); - connect( mSpinCellSizeX, SIGNAL( valueChanged( double ) ), this, SLOT( updateParametersFromReferenceLayer() ) ); - connect( mSpinCellSizeY, SIGNAL( valueChanged( double ) ), this, SLOT( updateParametersFromReferenceLayer() ) ); - connect( mSpinGridOffsetX, SIGNAL( valueChanged( double ) ), this, SLOT( updateParametersFromReferenceLayer() ) ); - connect( mSpinGridOffsetY, SIGNAL( valueChanged( double ) ), this, SLOT( updateParametersFromReferenceLayer() ) ); + connect( mCboReferenceLayer, static_cast( &QComboBox::currentIndexChanged ), this, [ = ] { referenceLayerChanged(); } ); + connect( mCrsSelector, &QgsProjectionSelectionWidget::crsChanged, this, &QgsAlignRasterDialog::destinationCrsChanged ); + connect( mSpinCellSizeX, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsAlignRasterDialog::updateParametersFromReferenceLayer ); + connect( mSpinCellSizeY, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsAlignRasterDialog::updateParametersFromReferenceLayer ); + connect( mSpinGridOffsetX, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsAlignRasterDialog::updateParametersFromReferenceLayer ); + connect( mSpinGridOffsetY, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsAlignRasterDialog::updateParametersFromReferenceLayer ); - connect( mChkCustomCRS, SIGNAL( clicked( bool ) ), this, SLOT( updateCustomCrs() ) ); - connect( mChkCustomCellSize, SIGNAL( clicked( bool ) ), this, SLOT( updateCustomCellSize() ) ); - connect( mChkCustomGridOffset, SIGNAL( clicked( bool ) ), this, SLOT( updateCustomGridOffset() ) ); + connect( mChkCustomCRS, &QAbstractButton::clicked, this, &QgsAlignRasterDialog::updateCustomCrs ); + connect( mChkCustomCellSize, &QAbstractButton::clicked, this, &QgsAlignRasterDialog::updateCustomCellSize ); + connect( mChkCustomGridOffset, &QAbstractButton::clicked, this, &QgsAlignRasterDialog::updateCustomGridOffset ); mClipExtentGroupBox->setChecked( false ); mClipExtentGroupBox->setCollapsed( true ); mClipExtentGroupBox->setTitleBase( tr( "Clip to Extent" ) ); QgsMapCanvas *mc = QgisApp::instance()->mapCanvas(); mClipExtentGroupBox->setCurrentExtent( mc->extent(), mc->mapSettings().destinationCrs() ); - connect( mClipExtentGroupBox, SIGNAL( extentChanged( QgsRectangle ) ), this, SLOT( clipExtentChanged() ) ); + connect( mClipExtentGroupBox, &QgsExtentGroupBox::extentChanged, this, &QgsAlignRasterDialog::clipExtentChanged ); // TODO: auto-detect reference layer - connect( buttonBox, SIGNAL( accepted() ), this, SLOT( runAlign() ) ); + connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsAlignRasterDialog::runAlign ); populateLayersView(); @@ -402,7 +402,7 @@ QgsAlignRasterLayerConfigDialog::QgsAlignRasterLayerConfigDialog() editOutput = new QLineEdit( this ); btnBrowse = new QPushButton( tr( "Browse..." ), this ); - connect( btnBrowse, SIGNAL( clicked( bool ) ), this, SLOT( browseOutputFilename() ) ); + connect( btnBrowse, &QAbstractButton::clicked, this, &QgsAlignRasterLayerConfigDialog::browseOutputFilename ); QHBoxLayout *layoutOutput = new QHBoxLayout(); layoutOutput->addWidget( editOutput ); @@ -411,8 +411,8 @@ QgsAlignRasterLayerConfigDialog::QgsAlignRasterLayerConfigDialog() chkRescale = new QCheckBox( tr( "Rescale values according to the cell size" ), this ); btnBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this ); - connect( btnBox, SIGNAL( accepted() ), this, SLOT( accept() ) ); - connect( btnBox, SIGNAL( rejected() ), this, SLOT( reject() ) ); + connect( btnBox, &QDialogButtonBox::accepted, this, &QDialog::accept ); + connect( btnBox, &QDialogButtonBox::rejected, this, &QDialog::reject ); layout->addWidget( new QLabel( tr( "Input raster layer:" ), this ) ); layout->addWidget( cboLayers ); diff --git a/src/app/qgsapplayertreeviewmenuprovider.cpp b/src/app/qgsapplayertreeviewmenuprovider.cpp index 47a5cd71887..2349491cb0b 100644 --- a/src/app/qgsapplayertreeviewmenuprovider.cpp +++ b/src/app/qgsapplayertreeviewmenuprovider.cpp @@ -170,7 +170,7 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu() colorWheel->setColor( singleRenderer->symbol()->color() ); QgsColorWidgetAction *colorAction = new QgsColorWidgetAction( colorWheel, menuStyleManager, menuStyleManager ); colorAction->setDismissOnColorSelection( false ); - connect( colorAction, SIGNAL( colorChanged( const QColor & ) ), this, SLOT( setVectorSymbolColor( const QColor & ) ) ); + connect( colorAction, &QgsColorWidgetAction::colorChanged, this, &QgsAppLayerTreeViewMenuProvider::setVectorSymbolColor ); //store the layer id in action, so we can later retrieve the corresponding layer colorAction->setProperty( "layerId", vlayer->id() ); menuStyleManager->addAction( colorAction ); @@ -184,14 +184,14 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu() recentColorAction->setProperty( "layerId", vlayer->id() ); recentColorAction->setDismissOnColorSelection( false ); menuStyleManager->addAction( recentColorAction ); - connect( recentColorAction, SIGNAL( colorChanged( const QColor & ) ), this, SLOT( setVectorSymbolColor( const QColor & ) ) ); + connect( recentColorAction, &QgsColorSwatchGridAction::colorChanged, this, &QgsAppLayerTreeViewMenuProvider::setVectorSymbolColor ); } menuStyleManager->addSeparator(); QAction *editSymbolAction = new QAction( tr( "Edit Symbol..." ), menuStyleManager ); //store the layer id in action, so we can later retrieve the corresponding layer editSymbolAction->setProperty( "layerId", vlayer->id() ); - connect( editSymbolAction, SIGNAL( triggered() ), this, SLOT( editVectorSymbol() ) ); + connect( editSymbolAction, &QAction::triggered, this, &QgsAppLayerTreeViewMenuProvider::editVectorSymbol ); menuStyleManager->addAction( editSymbolAction ); } } @@ -305,7 +305,7 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu() colorWheel->setColor( symbolNode->symbol()->color() ); QgsColorWidgetAction *colorAction = new QgsColorWidgetAction( colorWheel, menu, menu ); colorAction->setDismissOnColorSelection( false ); - connect( colorAction, SIGNAL( colorChanged( const QColor & ) ), this, SLOT( setSymbolLegendNodeColor( const QColor & ) ) ); + connect( colorAction, &QgsColorWidgetAction::colorChanged, this, &QgsAppLayerTreeViewMenuProvider::setSymbolLegendNodeColor ); //store the layer id and rule key in action, so we can later retrieve the corresponding //legend node, if it still exists colorAction->setProperty( "layerId", symbolNode->layerNode()->layerId() ); @@ -322,7 +322,7 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu() recentColorAction->setProperty( "ruleKey", symbolNode->data( QgsLayerTreeModelLegendNode::RuleKeyRole ).toString() ); recentColorAction->setDismissOnColorSelection( false ); menu->addAction( recentColorAction ); - connect( recentColorAction, SIGNAL( colorChanged( const QColor & ) ), this, SLOT( setSymbolLegendNodeColor( const QColor & ) ) ); + connect( recentColorAction, &QgsColorSwatchGridAction::colorChanged, this, &QgsAppLayerTreeViewMenuProvider::setSymbolLegendNodeColor ); } menu->addSeparator(); @@ -333,7 +333,7 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu() //legend node, if it still exists editSymbolAction->setProperty( "layerId", symbolNode->layerNode()->layerId() ); editSymbolAction->setProperty( "ruleKey", symbolNode->data( QgsLayerTreeModelLegendNode::RuleKeyRole ).toString() ); - connect( editSymbolAction, SIGNAL( triggered() ), this, SLOT( editSymbolLegendNodeSymbol() ) ); + connect( editSymbolAction, &QAction::triggered, this, &QgsAppLayerTreeViewMenuProvider::editSymbolLegendNodeSymbol ); menu->addAction( editSymbolAction ); } } diff --git a/src/app/qgsattributeactiondialog.cpp b/src/app/qgsattributeactiondialog.cpp index eeb9d854cf6..b15dea77c5f 100644 --- a/src/app/qgsattributeactiondialog.cpp +++ b/src/app/qgsattributeactiondialog.cpp @@ -49,13 +49,13 @@ QgsAttributeActionDialog::QgsAttributeActionDialog( const QgsActionManager &acti mAttributeActionTable->setCornerButtonEnabled( false ); mAttributeActionTable->setEditTriggers( QAbstractItemView::AnyKeyPressed | QAbstractItemView::SelectedClicked ); - connect( mAttributeActionTable, SIGNAL( itemDoubleClicked( QTableWidgetItem * ) ), this, SLOT( itemDoubleClicked( QTableWidgetItem * ) ) ); - connect( mAttributeActionTable, SIGNAL( itemSelectionChanged() ), this, SLOT( updateButtons() ) ); - connect( mMoveUpButton, SIGNAL( clicked() ), this, SLOT( moveUp() ) ); - connect( mMoveDownButton, SIGNAL( clicked() ), this, SLOT( moveDown() ) ); - connect( mRemoveButton, SIGNAL( clicked() ), this, SLOT( remove() ) ); - connect( mAddButton, SIGNAL( clicked( bool ) ), this, SLOT( insert() ) ); - connect( mAddDefaultActionsButton, SIGNAL( clicked() ), this, SLOT( addDefaultActions() ) ); + connect( mAttributeActionTable, &QTableWidget::itemDoubleClicked, this, &QgsAttributeActionDialog::itemDoubleClicked ); + connect( mAttributeActionTable, &QTableWidget::itemSelectionChanged, this, &QgsAttributeActionDialog::updateButtons ); + connect( mMoveUpButton, &QAbstractButton::clicked, this, &QgsAttributeActionDialog::moveUp ); + connect( mMoveDownButton, &QAbstractButton::clicked, this, &QgsAttributeActionDialog::moveDown ); + connect( mRemoveButton, &QAbstractButton::clicked, this, &QgsAttributeActionDialog::remove ); + connect( mAddButton, &QAbstractButton::clicked, this, &QgsAttributeActionDialog::insert ); + connect( mAddDefaultActionsButton, &QAbstractButton::clicked, this, &QgsAttributeActionDialog::addDefaultActions ); init( actions, mLayer->attributeTableConfig() ); } diff --git a/src/app/qgsattributeactionpropertiesdialog.cpp b/src/app/qgsattributeactionpropertiesdialog.cpp index 65fa5a1f589..bdcf4b7db04 100644 --- a/src/app/qgsattributeactionpropertiesdialog.cpp +++ b/src/app/qgsattributeactionpropertiesdialog.cpp @@ -207,11 +207,11 @@ void QgsAttributeActionPropertiesDialog::init( const QSet &actionScopes mFieldExpression->setGeomCalculator( myDa ); mFieldExpression->registerExpressionContextGenerator( this ); - connect( mBrowseButton, SIGNAL( clicked( bool ) ), this, SLOT( browse() ) ); - connect( mInsertFieldOrExpression, SIGNAL( clicked( bool ) ), this, SLOT( insertExpressionOrField() ) ); - connect( mActionName, SIGNAL( textChanged( QString ) ), this, SLOT( updateButtons() ) ); - connect( mActionText, SIGNAL( textChanged() ), this, SLOT( updateButtons() ) ); - connect( mChooseIconButton, SIGNAL( clicked( bool ) ), this, SLOT( chooseIcon() ) ); + connect( mBrowseButton, &QAbstractButton::clicked, this, &QgsAttributeActionPropertiesDialog::browse ); + connect( mInsertFieldOrExpression, &QAbstractButton::clicked, this, &QgsAttributeActionPropertiesDialog::insertExpressionOrField ); + connect( mActionName, &QLineEdit::textChanged, this, &QgsAttributeActionPropertiesDialog::updateButtons ); + connect( mActionText, &QsciScintilla::textChanged, this, &QgsAttributeActionPropertiesDialog::updateButtons ); + connect( mChooseIconButton, &QAbstractButton::clicked, this, &QgsAttributeActionPropertiesDialog::chooseIcon ); updateButtons(); } diff --git a/src/app/qgsattributetabledialog.cpp b/src/app/qgsattributetabledialog.cpp index 18f5c8fab68..bde2a2bea14 100644 --- a/src/app/qgsattributetabledialog.cpp +++ b/src/app/qgsattributetabledialog.cpp @@ -170,41 +170,41 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *layer, QWidget mActionEditedFilter->setIcon( filterIcon ); // Connect filter signals - connect( mActionAdvancedFilter, SIGNAL( triggered() ), SLOT( filterExpressionBuilder() ) ); - connect( mActionShowAllFilter, SIGNAL( triggered() ), SLOT( filterShowAll() ) ); - connect( mActionSelectedFilter, SIGNAL( triggered() ), SLOT( filterSelected() ) ); - connect( mActionVisibleFilter, SIGNAL( triggered() ), SLOT( filterVisible() ) ); - connect( mActionEditedFilter, SIGNAL( triggered() ), SLOT( filterEdited() ) ); + connect( mActionAdvancedFilter, &QAction::triggered, this, &QgsAttributeTableDialog::filterExpressionBuilder ); + connect( mActionShowAllFilter, &QAction::triggered, this, &QgsAttributeTableDialog::filterShowAll ); + connect( mActionSelectedFilter, &QAction::triggered, this, &QgsAttributeTableDialog::filterSelected ); + connect( mActionVisibleFilter, &QAction::triggered, this, &QgsAttributeTableDialog::filterVisible ); + connect( mActionEditedFilter, &QAction::triggered, this, &QgsAttributeTableDialog::filterEdited ); connect( mFilterActionMapper, SIGNAL( mapped( QObject * ) ), SLOT( filterColumnChanged( QObject * ) ) ); - connect( mFilterQuery, SIGNAL( returnPressed() ), SLOT( filterQueryAccepted() ) ); - connect( mActionApplyFilter, SIGNAL( triggered() ), SLOT( filterQueryAccepted() ) ); - connect( mActionSetStyles, SIGNAL( triggered() ), SLOT( openConditionalStyles() ) ); + connect( mFilterQuery, &QLineEdit::returnPressed, this, &QgsAttributeTableDialog::filterQueryAccepted ); + connect( mActionApplyFilter, &QAction::triggered, this, &QgsAttributeTableDialog::filterQueryAccepted ); + connect( mActionSetStyles, &QAction::triggered, this, &QgsAttributeTableDialog::openConditionalStyles ); // info from layer to table - connect( mLayer, SIGNAL( editingStarted() ), this, SLOT( editingToggled() ) ); - connect( mLayer, SIGNAL( editingStopped() ), this, SLOT( editingToggled() ) ); - connect( mLayer, SIGNAL( destroyed() ), this, SLOT( close() ) ); + connect( mLayer, &QgsVectorLayer::editingStarted, this, &QgsAttributeTableDialog::editingToggled ); + connect( mLayer, &QgsVectorLayer::editingStopped, this, &QgsAttributeTableDialog::editingToggled ); + connect( mLayer, &QObject::destroyed, this, &QWidget::close ); connect( mLayer, &QgsVectorLayer::selectionChanged, this, &QgsAttributeTableDialog::updateTitle ); - connect( mLayer, SIGNAL( featureAdded( QgsFeatureId ) ), this, SLOT( updateTitle() ) ); - connect( mLayer, SIGNAL( featuresDeleted( QgsFeatureIds ) ), this, SLOT( updateTitle() ) ); - connect( mLayer, SIGNAL( attributeAdded( int ) ), this, SLOT( columnBoxInit() ) ); - connect( mLayer, SIGNAL( attributeDeleted( int ) ), this, SLOT( columnBoxInit() ) ); + connect( mLayer, &QgsVectorLayer::featureAdded, this, &QgsAttributeTableDialog::updateTitle ); + connect( mLayer, &QgsVectorLayer::featuresDeleted, this, &QgsAttributeTableDialog::updateTitle ); + connect( mLayer, &QgsVectorLayer::attributeAdded, this, &QgsAttributeTableDialog::columnBoxInit ); + connect( mLayer, &QgsVectorLayer::attributeDeleted, this, &QgsAttributeTableDialog::columnBoxInit ); connect( mLayer, &QgsVectorLayer::readOnlyChanged, this, &QgsAttributeTableDialog::editingToggled ); // connect table info to window - connect( mMainView, SIGNAL( filterChanged() ), this, SLOT( updateTitle() ) ); - connect( mMainView, SIGNAL( filterExpressionSet( QString, QgsAttributeForm::FilterType ) ), this, SLOT( formFilterSet( QString, QgsAttributeForm::FilterType ) ) ); - connect( mMainView, SIGNAL( formModeChanged( QgsAttributeForm::Mode ) ), this, SLOT( viewModeChanged( QgsAttributeForm::Mode ) ) ); + connect( mMainView, &QgsDualView::filterChanged, this, &QgsAttributeTableDialog::updateTitle ); + connect( mMainView, &QgsDualView::filterExpressionSet, this, &QgsAttributeTableDialog::formFilterSet ); + connect( mMainView, &QgsDualView::formModeChanged, this, &QgsAttributeTableDialog::viewModeChanged ); // info from table to application - connect( this, SIGNAL( saveEdits( QgsMapLayer * ) ), QgisApp::instance(), SLOT( saveEdits( QgsMapLayer * ) ) ); + connect( this, &QgsAttributeTableDialog::saveEdits, this, [ = ] { QgisApp::instance()->saveEdits(); } ); bool myDockFlag = settings.value( QStringLiteral( "qgis/dockAttributeTable" ), false ).toBool(); if ( myDockFlag ) { mDock = new QgsAttributeTableDock( tr( "%1 (%n Feature(s))", "feature count", mMainView->featureCount() ).arg( mLayer->name() ), QgisApp::instance() ); mDock->setWidget( this ); - connect( this, SIGNAL( destroyed() ), mDock, SLOT( close() ) ); + connect( this, &QObject::destroyed, mDock, &QWidget::close ); QgisApp::instance()->addDockWidget( Qt::BottomDockWidgetArea, mDock ); } @@ -283,11 +283,11 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *layer, QWidget mFieldCombo->setFilters( QgsFieldProxyModel::AllTypes | QgsFieldProxyModel::HideReadOnly ); mFieldCombo->setLayer( mLayer ); - connect( mRunFieldCalc, SIGNAL( clicked() ), this, SLOT( updateFieldFromExpression() ) ); - connect( mRunFieldCalcSelected, SIGNAL( clicked() ), this, SLOT( updateFieldFromExpressionSelected() ) ); + connect( mRunFieldCalc, &QAbstractButton::clicked, this, &QgsAttributeTableDialog::updateFieldFromExpression ); + connect( mRunFieldCalcSelected, &QAbstractButton::clicked, this, &QgsAttributeTableDialog::updateFieldFromExpressionSelected ); // NW TODO Fix in 2.6 - Doesn't work with field model for some reason. // connect( mUpdateExpressionText, SIGNAL( returnPressed() ), this, SLOT( updateFieldFromExpression() ) ); - connect( mUpdateExpressionText, SIGNAL( fieldChanged( QString, bool ) ), this, SLOT( updateButtonStatus( QString, bool ) ) ); + connect( mUpdateExpressionText, static_cast < void ( QgsFieldExpressionWidget::* )( const QString &, bool ) > ( &QgsFieldExpressionWidget::fieldChanged ), this, &QgsAttributeTableDialog::updateButtonStatus ); mUpdateExpressionText->setLayer( mLayer ); mUpdateExpressionText->setLeftHandButtonStyle( true ); @@ -299,8 +299,8 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *layer, QWidget mMainView->setView( static_cast< QgsDualView::ViewMode >( initialView ) ); mMainViewButtonGroup->button( initialView )->setChecked( true ); - connect( mActionToggleMultiEdit, SIGNAL( toggled( bool ) ), mMainView, SLOT( setMultiEditEnabled( bool ) ) ); - connect( mActionSearchForm, SIGNAL( toggled( bool ) ), mMainView, SLOT( toggleSearchMode( bool ) ) ); + connect( mActionToggleMultiEdit, &QAction::toggled, mMainView, &QgsDualView::setMultiEditEnabled ); + connect( mActionSearchForm, &QAction::toggled, mMainView, &QgsDualView::toggleSearchMode ); updateMultiEditButtonState(); if ( mLayer->editFormConfig().layout() == QgsEditFormConfig::UiFileLayout ) @@ -566,12 +566,12 @@ void QgsAttributeTableDialog::filterColumnChanged( QObject *filterAction ) createSearchWidget( setup.type(), mLayer, fldIdx, setup.config(), mFilterContainer, mEditorContext ); if ( mCurrentSearchWidgetWrapper->applyDirectly() ) { - connect( mCurrentSearchWidgetWrapper, SIGNAL( expressionChanged( QString ) ), SLOT( filterQueryChanged( QString ) ) ); + connect( mCurrentSearchWidgetWrapper, &QgsSearchWidgetWrapper::expressionChanged, this, &QgsAttributeTableDialog::filterQueryChanged ); mApplyFilterButton->setVisible( false ); } else { - connect( mCurrentSearchWidgetWrapper, SIGNAL( expressionChanged( QString ) ), SLOT( filterQueryAccepted() ) ); + connect( mCurrentSearchWidgetWrapper, &QgsSearchWidgetWrapper::expressionChanged, this, &QgsAttributeTableDialog::filterQueryAccepted ); mApplyFilterButton->setVisible( true ); }