From bd17999755cd65d687f77682267216e01b854f88 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Tue, 21 Mar 2017 16:48:19 +1000 Subject: [PATCH] Swap QgisApp to use new style connects --- src/app/qgisapp.cpp | 628 +++++++++--------- src/app/qgisapp.h | 5 +- .../qgslayertreeviewdefaultactions.h | 2 +- 3 files changed, 320 insertions(+), 315 deletions(-) diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index 609fdf41fc45..2ba99d6051b5 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -683,8 +683,8 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh startProfile( QStringLiteral( "Building style sheet" ) ); // set up stylesheet builder and apply saved or default style options mStyleSheetBuilder = new QgisAppStyleSheet( this ); - connect( mStyleSheetBuilder, SIGNAL( appStyleSheetChanged( const QString & ) ), - this, SLOT( setAppStyleSheet( const QString & ) ) ); + connect( mStyleSheetBuilder, &QgisAppStyleSheet::appStyleSheetChanged, + this, &QgisApp::setAppStyleSheet ); mStyleSheetBuilder->buildStyleSheet( mStyleSheetBuilder->defaultOptions() ); endProfile(); @@ -836,8 +836,8 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh mMapStylingDock->setObjectName( QStringLiteral( "LayerStyling" ) ); mMapStyleWidget = new QgsLayerStylingWidget( mMapCanvas, mMapLayerPanelFactories ); mMapStylingDock->setWidget( mMapStyleWidget ); - connect( mMapStyleWidget, SIGNAL( styleChanged( QgsMapLayer * ) ), this, SLOT( updateLabelToolButtons() ) ); - connect( mMapStylingDock, SIGNAL( visibilityChanged( bool ) ), mActionStyleDock, SLOT( setChecked( bool ) ) ); + connect( mMapStyleWidget, &QgsLayerStylingWidget::styleChanged, this, &QgisApp::updateLabelToolButtons ); + connect( mMapStylingDock, &QDockWidget::visibilityChanged, mActionStyleDock, &QAction::setChecked ); addDockWidget( Qt::RightDockWidgetArea, mMapStylingDock ); mMapStylingDock->hide(); @@ -911,17 +911,17 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh addDockWidget( Qt::BottomDockWidgetArea, mLogDock ); mLogDock->setWidget( mLogViewer ); mLogDock->hide(); - connect( mMessageButton, SIGNAL( toggled( bool ) ), mLogDock, SLOT( setVisible( bool ) ) ); - connect( mLogDock, SIGNAL( visibilityChanged( bool ) ), mMessageButton, SLOT( setChecked( bool ) ) ); - connect( QgsApplication::messageLog(), SIGNAL( messageReceived( bool ) ), this, SLOT( toggleLogMessageIcon( bool ) ) ); - connect( mMessageButton, SIGNAL( toggled( bool ) ), this, SLOT( toggleLogMessageIcon( bool ) ) ); + connect( mMessageButton, &QAbstractButton::toggled, mLogDock, &QWidget::setVisible ); + connect( mLogDock, &QDockWidget::visibilityChanged, mMessageButton, &QAbstractButton::setChecked ); + connect( QgsApplication::messageLog(), static_cast < void ( QgsMessageLog::* )( bool ) >( &QgsMessageLog::messageReceived ), this, &QgisApp::toggleLogMessageIcon ); + connect( mMessageButton, &QAbstractButton::toggled, this, &QgisApp::toggleLogMessageIcon ); mVectorLayerTools = new QgsGuiVectorLayerTools(); // Init the editor widget types QgsEditorWidgetRegistry::initEditors( mMapCanvas, mInfoBar ); mInternalClipboard = new QgsClipboard; // create clipboard - connect( mInternalClipboard, SIGNAL( changed() ), this, SLOT( clipboardChanged() ) ); + connect( mInternalClipboard, &QgsClipboard::changed, this, &QgisApp::clipboardChanged ); mQgisInterface = new QgisAppInterface( this ); // create the interfce #ifdef Q_OS_MAC @@ -935,7 +935,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh activateDeactivateLayerRelatedActions( nullptr ); // after members were created - connect( QgsMapLayerActionRegistry::instance(), SIGNAL( changed() ), this, SLOT( refreshActionFeatureAction() ) ); + connect( QgsMapLayerActionRegistry::instance(), &QgsMapLayerActionRegistry::changed, this, &QgisApp::refreshActionFeatureAction ); // set application's caption QString caption = tr( "QGIS - %1 ('%2')" ).arg( Qgis::QGIS_VERSION, Qgis::QGIS_RELEASE_NAME ); @@ -944,8 +944,8 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh QgsMessageLog::logMessage( tr( "QGIS starting..." ), QString::null, QgsMessageLog::INFO ); // set QGIS specific srs validation - connect( this, SIGNAL( customCrsValidation( QgsCoordinateReferenceSystem & ) ), - this, SLOT( validateCrs( QgsCoordinateReferenceSystem & ) ) ); + connect( this, &QgisApp::customCrsValidation, + this, &QgisApp::validateCrs ); QgsCoordinateReferenceSystem::setCustomCrsValidation( customSrsValidation_ ); // set graphical message output @@ -1103,7 +1103,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh //also make ctrl+alt+= a shortcut to switch to zoom in map tool QShortcut *zoomInToolShortCut = new QShortcut( QKeySequence( tr( "Ctrl+Alt+=" ) ), this ); - connect( zoomInToolShortCut, SIGNAL( activated() ), this, SLOT( zoomIn() ) ); + connect( zoomInToolShortCut, &QShortcut::activated, this, &QgisApp::zoomIn ); zoomInToolShortCut->setObjectName( QStringLiteral( "ZoomIn2" ) ); zoomInToolShortCut->setWhatsThis( tr( "Zoom in (secondary)" ) ); zoomInToolShortCut->setProperty( "Icon", QgsApplication::getThemeIcon( QStringLiteral( "/mActionZoomIn.svg" ) ) ); @@ -1463,7 +1463,7 @@ void QgisApp::dropEvent( QDropEvent *event ) } timer->setProperty( "uris", QVariant::fromValue( lst ) ); - connect( timer, SIGNAL( timeout() ), this, SLOT( dropEventTimeout() ) ); + connect( timer, &QTimer::timeout, this, &QgisApp::dropEventTimeout ); event->acceptProposedAction(); timer->start(); @@ -1679,161 +1679,161 @@ void QgisApp::createActions() // Project Menu Items - connect( mActionNewProject, SIGNAL( triggered() ), this, SLOT( fileNew() ) ); - connect( mActionNewBlankProject, SIGNAL( triggered() ), this, SLOT( fileNewBlank() ) ); - connect( mActionOpenProject, SIGNAL( triggered() ), this, SLOT( fileOpen() ) ); - connect( mActionSaveProject, SIGNAL( triggered() ), this, SLOT( fileSave() ) ); - connect( mActionSaveProjectAs, SIGNAL( triggered() ), this, SLOT( fileSaveAs() ) ); - connect( mActionSaveMapAsImage, SIGNAL( triggered() ), this, SLOT( saveMapAsImage() ) ); + connect( mActionNewProject, &QAction::triggered, this, [ = ] { fileNew(); } ); + connect( mActionNewBlankProject, &QAction::triggered, this, &QgisApp::fileNewBlank ); + connect( mActionOpenProject, &QAction::triggered, this, &QgisApp::fileOpen ); + connect( mActionSaveProject, &QAction::triggered, this, &QgisApp::fileSave ); + connect( mActionSaveProjectAs, &QAction::triggered, this, &QgisApp::fileSaveAs ); + connect( mActionSaveMapAsImage, &QAction::triggered, this, [ = ] { saveMapAsImage(); } ); connect( mActionNewMapCanvas, &QAction::triggered, this, &QgisApp::newMapCanvas ); - connect( mActionNewPrintComposer, SIGNAL( triggered() ), this, SLOT( newPrintComposer() ) ); - connect( mActionShowComposerManager, SIGNAL( triggered() ), this, SLOT( showComposerManager() ) ); - connect( mActionExit, SIGNAL( triggered() ), this, SLOT( fileExit() ) ); - connect( mActionDxfExport, SIGNAL( triggered() ), this, SLOT( dxfExport() ) ); - connect( mActionDwgImport, SIGNAL( triggered() ), this, SLOT( dwgImport() ) ); + connect( mActionNewPrintComposer, &QAction::triggered, this, &QgisApp::newPrintComposer ); + connect( mActionShowComposerManager, &QAction::triggered, this, &QgisApp::showComposerManager ); + connect( mActionExit, &QAction::triggered, this, &QgisApp::fileExit ); + connect( mActionDxfExport, &QAction::triggered, this, &QgisApp::dxfExport ); + connect( mActionDwgImport, &QAction::triggered, this, &QgisApp::dwgImport ); // Edit Menu Items - connect( mActionUndo, SIGNAL( triggered() ), mUndoWidget, SLOT( undo() ) ); - connect( mActionRedo, SIGNAL( triggered() ), mUndoWidget, SLOT( redo() ) ); - connect( mActionCutFeatures, SIGNAL( triggered() ), this, SLOT( editCut() ) ); - connect( mActionCopyFeatures, SIGNAL( triggered() ), this, SLOT( editCopy() ) ); - connect( mActionPasteFeatures, SIGNAL( triggered() ), this, SLOT( editPaste() ) ); - connect( mActionPasteAsNewVector, SIGNAL( triggered() ), this, SLOT( pasteAsNewVector() ) ); - connect( mActionPasteAsNewMemoryVector, SIGNAL( triggered() ), this, SLOT( pasteAsNewMemoryVector() ) ); - connect( mActionCopyStyle, SIGNAL( triggered() ), this, SLOT( copyStyle() ) ); - connect( mActionPasteStyle, SIGNAL( triggered() ), this, SLOT( pasteStyle() ) ); - connect( mActionAddFeature, SIGNAL( triggered() ), this, SLOT( addFeature() ) ); - connect( mActionCircularStringCurvePoint, SIGNAL( triggered() ), this, SLOT( circularStringCurvePoint() ) ); - connect( mActionCircularStringRadius, SIGNAL( triggered() ), this, SLOT( circularStringRadius() ) ); - connect( mActionMoveFeature, SIGNAL( triggered() ), this, SLOT( moveFeature() ) ); + connect( mActionUndo, &QAction::triggered, mUndoWidget, &QgsUndoWidget::undo ); + connect( mActionRedo, &QAction::triggered, mUndoWidget, &QgsUndoWidget::redo ); + connect( mActionCutFeatures, &QAction::triggered, this, [ = ] { editCut(); } ); + connect( mActionCopyFeatures, &QAction::triggered, this, [ = ] { editCopy(); } ); + connect( mActionPasteFeatures, &QAction::triggered, this, [ = ] { editPaste(); } ); + connect( mActionPasteAsNewVector, &QAction::triggered, this, &QgisApp::pasteAsNewVector ); + connect( mActionPasteAsNewMemoryVector, &QAction::triggered, this, [ = ] { pasteAsNewMemoryVector(); } ); + connect( mActionCopyStyle, &QAction::triggered, this, [ = ] { copyStyle(); } ); + connect( mActionPasteStyle, &QAction::triggered, this, [ = ] { pasteStyle(); } ); + connect( mActionAddFeature, &QAction::triggered, this, &QgisApp::addFeature ); + connect( mActionCircularStringCurvePoint, &QAction::triggered, this, &QgisApp::circularStringCurvePoint ); + connect( mActionCircularStringRadius, &QAction::triggered, this, &QgisApp::circularStringRadius ); + connect( mActionMoveFeature, &QAction::triggered, this, &QgisApp::moveFeature ); connect( mActionMoveFeatureCopy, &QAction::triggered, this, &QgisApp::moveFeatureCopy ); - connect( mActionRotateFeature, SIGNAL( triggered() ), this, SLOT( rotateFeature() ) ); - - connect( mActionReshapeFeatures, SIGNAL( triggered() ), this, SLOT( reshapeFeatures() ) ); - connect( mActionSplitFeatures, SIGNAL( triggered() ), this, SLOT( splitFeatures() ) ); - connect( mActionSplitParts, SIGNAL( triggered() ), this, SLOT( splitParts() ) ); - connect( mActionDeleteSelected, SIGNAL( triggered() ), this, SLOT( deleteSelected() ) ); - connect( mActionAddRing, SIGNAL( triggered() ), this, SLOT( addRing() ) ); - connect( mActionFillRing, SIGNAL( triggered() ), this, SLOT( fillRing() ) ); - connect( mActionAddPart, SIGNAL( triggered() ), this, SLOT( addPart() ) ); - connect( mActionSimplifyFeature, SIGNAL( triggered() ), this, SLOT( simplifyFeature() ) ); - connect( mActionDeleteRing, SIGNAL( triggered() ), this, SLOT( deleteRing() ) ); - connect( mActionDeletePart, SIGNAL( triggered() ), this, SLOT( deletePart() ) ); - connect( mActionMergeFeatures, SIGNAL( triggered() ), this, SLOT( mergeSelectedFeatures() ) ); - connect( mActionMergeFeatureAttributes, SIGNAL( triggered() ), this, SLOT( mergeAttributesOfSelectedFeatures() ) ); - connect( mActionMultiEditAttributes, SIGNAL( triggered() ), this, SLOT( modifyAttributesOfSelectedFeatures() ) ); - connect( mActionNodeTool, SIGNAL( triggered() ), this, SLOT( nodeTool() ) ); - connect( mActionRotatePointSymbols, SIGNAL( triggered() ), this, SLOT( rotatePointSymbols() ) ); - connect( mActionOffsetPointSymbol, SIGNAL( triggered() ), this, SLOT( offsetPointSymbol() ) ); - connect( mActionSnappingOptions, SIGNAL( triggered() ), this, SLOT( snappingOptions() ) ); - connect( mActionOffsetCurve, SIGNAL( triggered() ), this, SLOT( offsetCurve() ) ); + connect( mActionRotateFeature, &QAction::triggered, this, &QgisApp::rotateFeature ); + + connect( mActionReshapeFeatures, &QAction::triggered, this, &QgisApp::reshapeFeatures ); + connect( mActionSplitFeatures, &QAction::triggered, this, &QgisApp::splitFeatures ); + connect( mActionSplitParts, &QAction::triggered, this, &QgisApp::splitParts ); + connect( mActionDeleteSelected, &QAction::triggered, this, [ = ] { deleteSelected(); } ); + connect( mActionAddRing, &QAction::triggered, this, &QgisApp::addRing ); + connect( mActionFillRing, &QAction::triggered, this, &QgisApp::fillRing ); + connect( mActionAddPart, &QAction::triggered, this, &QgisApp::addPart ); + connect( mActionSimplifyFeature, &QAction::triggered, this, &QgisApp::simplifyFeature ); + connect( mActionDeleteRing, &QAction::triggered, this, &QgisApp::deleteRing ); + connect( mActionDeletePart, &QAction::triggered, this, &QgisApp::deletePart ); + connect( mActionMergeFeatures, &QAction::triggered, this, &QgisApp::mergeSelectedFeatures ); + connect( mActionMergeFeatureAttributes, &QAction::triggered, this, &QgisApp::mergeAttributesOfSelectedFeatures ); + connect( mActionMultiEditAttributes, &QAction::triggered, this, &QgisApp::modifyAttributesOfSelectedFeatures ); + connect( mActionNodeTool, &QAction::triggered, this, &QgisApp::nodeTool ); + connect( mActionRotatePointSymbols, &QAction::triggered, this, &QgisApp::rotatePointSymbols ); + connect( mActionOffsetPointSymbol, &QAction::triggered, this, &QgisApp::offsetPointSymbol ); + connect( mActionSnappingOptions, &QAction::triggered, this, &QgisApp::snappingOptions ); + connect( mActionOffsetCurve, &QAction::triggered, this, &QgisApp::offsetCurve ); // View Menu Items - connect( mActionPan, SIGNAL( triggered() ), this, SLOT( pan() ) ); - connect( mActionPanToSelected, SIGNAL( triggered() ), this, SLOT( panToSelected() ) ); - connect( mActionZoomIn, SIGNAL( triggered() ), this, SLOT( zoomIn() ) ); - connect( mActionZoomOut, SIGNAL( triggered() ), this, SLOT( zoomOut() ) ); - connect( mActionSelectFeatures, SIGNAL( triggered() ), this, SLOT( selectFeatures() ) ); - connect( mActionSelectPolygon, SIGNAL( triggered() ), this, SLOT( selectByPolygon() ) ); - connect( mActionSelectFreehand, SIGNAL( triggered() ), this, SLOT( selectByFreehand() ) ); - connect( mActionSelectRadius, SIGNAL( triggered() ), this, SLOT( selectByRadius() ) ); - connect( mActionDeselectAll, SIGNAL( triggered() ), this, SLOT( deselectAll() ) ); - connect( mActionSelectAll, SIGNAL( triggered() ), this, SLOT( selectAll() ) ); - connect( mActionInvertSelection, SIGNAL( triggered() ), this, SLOT( invertSelection() ) ); - connect( mActionSelectByExpression, SIGNAL( triggered() ), this, SLOT( selectByExpression() ) ); - connect( mActionSelectByForm, SIGNAL( triggered() ), this, SLOT( selectByForm() ) ); - connect( mActionIdentify, SIGNAL( triggered() ), this, SLOT( identify() ) ); - connect( mActionFeatureAction, SIGNAL( triggered() ), this, SLOT( doFeatureAction() ) ); - connect( mActionMeasure, SIGNAL( triggered() ), this, SLOT( measure() ) ); - connect( mActionMeasureArea, SIGNAL( triggered() ), this, SLOT( measureArea() ) ); - connect( mActionMeasureAngle, SIGNAL( triggered() ), this, SLOT( measureAngle() ) ); - connect( mActionZoomFullExtent, SIGNAL( triggered() ), this, SLOT( zoomFull() ) ); - connect( mActionZoomToLayer, SIGNAL( triggered() ), this, SLOT( zoomToLayerExtent() ) ); - connect( mActionZoomToSelected, SIGNAL( triggered() ), this, SLOT( zoomToSelected() ) ); - connect( mActionZoomLast, SIGNAL( triggered() ), this, SLOT( zoomToPrevious() ) ); - connect( mActionZoomNext, SIGNAL( triggered() ), this, SLOT( zoomToNext() ) ); - connect( mActionZoomActualSize, SIGNAL( triggered() ), this, SLOT( zoomActualSize() ) ); - connect( mActionMapTips, SIGNAL( toggled( bool ) ), this, SLOT( toggleMapTips( bool ) ) ); - connect( mActionNewBookmark, SIGNAL( triggered() ), this, SLOT( newBookmark() ) ); - connect( mActionShowBookmarks, SIGNAL( triggered() ), this, SLOT( showBookmarks() ) ); - connect( mActionDraw, SIGNAL( triggered() ), this, SLOT( refreshMapCanvas() ) ); - connect( mActionTextAnnotation, SIGNAL( triggered() ), this, SLOT( addTextAnnotation() ) ); - connect( mActionFormAnnotation, SIGNAL( triggered() ), this, SLOT( addFormAnnotation() ) ); - connect( mActionHtmlAnnotation, SIGNAL( triggered() ), this, SLOT( addHtmlAnnotation() ) ); - connect( mActionSvgAnnotation, SIGNAL( triggered() ), this, SLOT( addSvgAnnotation() ) ); - connect( mActionAnnotation, SIGNAL( triggered() ), this, SLOT( modifyAnnotation() ) ); - connect( mActionLabeling, SIGNAL( triggered() ), this, SLOT( labeling() ) ); - connect( mActionStatisticalSummary, SIGNAL( triggered() ), this, SLOT( showStatisticsDockWidget() ) ); + connect( mActionPan, &QAction::triggered, this, &QgisApp::pan ); + connect( mActionPanToSelected, &QAction::triggered, this, &QgisApp::panToSelected ); + connect( mActionZoomIn, &QAction::triggered, this, &QgisApp::zoomIn ); + connect( mActionZoomOut, &QAction::triggered, this, &QgisApp::zoomOut ); + connect( mActionSelectFeatures, &QAction::triggered, this, &QgisApp::selectFeatures ); + connect( mActionSelectPolygon, &QAction::triggered, this, &QgisApp::selectByPolygon ); + connect( mActionSelectFreehand, &QAction::triggered, this, &QgisApp::selectByFreehand ); + connect( mActionSelectRadius, &QAction::triggered, this, &QgisApp::selectByRadius ); + connect( mActionDeselectAll, &QAction::triggered, this, &QgisApp::deselectAll ); + connect( mActionSelectAll, &QAction::triggered, this, &QgisApp::selectAll ); + connect( mActionInvertSelection, &QAction::triggered, this, &QgisApp::invertSelection ); + connect( mActionSelectByExpression, &QAction::triggered, this, &QgisApp::selectByExpression ); + connect( mActionSelectByForm, &QAction::triggered, this, &QgisApp::selectByForm ); + connect( mActionIdentify, &QAction::triggered, this, &QgisApp::identify ); + connect( mActionFeatureAction, &QAction::triggered, this, &QgisApp::doFeatureAction ); + connect( mActionMeasure, &QAction::triggered, this, &QgisApp::measure ); + connect( mActionMeasureArea, &QAction::triggered, this, &QgisApp::measureArea ); + connect( mActionMeasureAngle, &QAction::triggered, this, &QgisApp::measureAngle ); + connect( mActionZoomFullExtent, &QAction::triggered, this, &QgisApp::zoomFull ); + connect( mActionZoomToLayer, &QAction::triggered, this, &QgisApp::zoomToLayerExtent ); + connect( mActionZoomToSelected, &QAction::triggered, this, &QgisApp::zoomToSelected ); + connect( mActionZoomLast, &QAction::triggered, this, &QgisApp::zoomToPrevious ); + connect( mActionZoomNext, &QAction::triggered, this, &QgisApp::zoomToNext ); + connect( mActionZoomActualSize, &QAction::triggered, this, &QgisApp::zoomActualSize ); + connect( mActionMapTips, &QAction::toggled, this, &QgisApp::toggleMapTips ); + connect( mActionNewBookmark, &QAction::triggered, this, &QgisApp::newBookmark ); + connect( mActionShowBookmarks, &QAction::triggered, this, &QgisApp::showBookmarks ); + connect( mActionDraw, &QAction::triggered, this, &QgisApp::refreshMapCanvas ); + connect( mActionTextAnnotation, &QAction::triggered, this, &QgisApp::addTextAnnotation ); + connect( mActionFormAnnotation, &QAction::triggered, this, &QgisApp::addFormAnnotation ); + connect( mActionHtmlAnnotation, &QAction::triggered, this, &QgisApp::addHtmlAnnotation ); + connect( mActionSvgAnnotation, &QAction::triggered, this, &QgisApp::addSvgAnnotation ); + connect( mActionAnnotation, &QAction::triggered, this, &QgisApp::modifyAnnotation ); + connect( mActionLabeling, &QAction::triggered, this, &QgisApp::labeling ); + connect( mActionStatisticalSummary, &QAction::triggered, this, &QgisApp::showStatisticsDockWidget ); // Layer Menu Items - connect( mActionNewVectorLayer, SIGNAL( triggered() ), this, SLOT( newVectorLayer() ) ); - connect( mActionNewSpatiaLiteLayer, SIGNAL( triggered() ), this, SLOT( newSpatialiteLayer() ) ); - connect( mActionNewGeoPackageLayer, SIGNAL( triggered() ), this, SLOT( newGeoPackageLayer() ) ); - connect( mActionNewMemoryLayer, SIGNAL( triggered() ), this, SLOT( newMemoryLayer() ) ); - connect( mActionShowRasterCalculator, SIGNAL( triggered() ), this, SLOT( showRasterCalculator() ) ); - connect( mActionShowAlignRasterTool, SIGNAL( triggered() ), this, SLOT( showAlignRasterTool() ) ); - connect( mActionEmbedLayers, SIGNAL( triggered() ), this, SLOT( embedLayers() ) ); - connect( mActionAddLayerDefinition, SIGNAL( triggered() ), this, SLOT( addLayerDefinition() ) ); - connect( mActionAddOgrLayer, SIGNAL( triggered() ), this, SLOT( addVectorLayer() ) ); - connect( mActionAddRasterLayer, SIGNAL( triggered() ), this, SLOT( addRasterLayer() ) ); - connect( mActionAddPgLayer, SIGNAL( triggered() ), this, SLOT( addDatabaseLayer() ) ); - connect( mActionAddSpatiaLiteLayer, SIGNAL( triggered() ), this, SLOT( addSpatiaLiteLayer() ) ); - connect( mActionAddMssqlLayer, SIGNAL( triggered() ), this, SLOT( addMssqlLayer() ) ); - connect( mActionAddDb2Layer, SIGNAL( triggered() ), this, SLOT( addDb2Layer() ) ); - connect( mActionAddOracleLayer, SIGNAL( triggered() ), this, SLOT( addOracleLayer() ) ); - connect( mActionAddWmsLayer, SIGNAL( triggered() ), this, SLOT( addWmsLayer() ) ); - connect( mActionAddWcsLayer, SIGNAL( triggered() ), this, SLOT( addWcsLayer() ) ); - connect( mActionAddWfsLayer, SIGNAL( triggered() ), this, SLOT( addWfsLayer() ) ); - connect( mActionAddAfsLayer, SIGNAL( triggered() ), this, SLOT( addAfsLayer() ) ); - connect( mActionAddAmsLayer, SIGNAL( triggered() ), this, SLOT( addAmsLayer() ) ); - connect( mActionAddDelimitedText, SIGNAL( triggered() ), this, SLOT( addDelimitedTextLayer() ) ); - connect( mActionAddVirtualLayer, SIGNAL( triggered() ), this, SLOT( addVirtualLayer() ) ); - connect( mActionOpenTable, SIGNAL( triggered() ), this, SLOT( attributeTable() ) ); - connect( mActionOpenFieldCalc, SIGNAL( triggered() ), this, SLOT( fieldCalculator() ) ); - connect( mActionToggleEditing, SIGNAL( triggered() ), this, SLOT( toggleEditing() ) ); - connect( mActionSaveLayerEdits, SIGNAL( triggered() ), this, SLOT( saveActiveLayerEdits() ) ); - connect( mActionSaveEdits, SIGNAL( triggered() ), this, SLOT( saveEdits() ) ); - connect( mActionSaveAllEdits, SIGNAL( triggered() ), this, SLOT( saveAllEdits() ) ); - connect( mActionRollbackEdits, SIGNAL( triggered() ), this, SLOT( rollbackEdits() ) ); - connect( mActionRollbackAllEdits, SIGNAL( triggered() ), this, SLOT( rollbackAllEdits() ) ); - connect( mActionCancelEdits, SIGNAL( triggered() ), this, SLOT( cancelEdits() ) ); - connect( mActionCancelAllEdits, SIGNAL( triggered() ), this, SLOT( cancelAllEdits() ) ); - connect( mActionLayerSaveAs, SIGNAL( triggered() ), this, SLOT( saveAsFile() ) ); - connect( mActionSaveLayerDefinition, SIGNAL( triggered() ), this, SLOT( saveAsLayerDefinition() ) ); - connect( mActionRemoveLayer, SIGNAL( triggered() ), this, SLOT( removeLayer() ) ); - connect( mActionDuplicateLayer, SIGNAL( triggered() ), this, SLOT( duplicateLayers() ) ); - connect( mActionSetLayerScaleVisibility, SIGNAL( triggered() ), this, SLOT( setLayerScaleVisibility() ) ); - connect( mActionSetLayerCRS, SIGNAL( triggered() ), this, SLOT( setLayerCrs() ) ); - connect( mActionSetProjectCRSFromLayer, SIGNAL( triggered() ), this, SLOT( setProjectCrsFromLayer() ) ); - connect( mActionLayerProperties, SIGNAL( triggered() ), this, SLOT( layerProperties() ) ); - connect( mActionLayerSubsetString, SIGNAL( triggered() ), this, SLOT( layerSubsetString() ) ); - connect( mActionAddToOverview, SIGNAL( triggered() ), this, SLOT( isInOverview() ) ); - connect( mActionAddAllToOverview, SIGNAL( triggered() ), this, SLOT( addAllToOverview() ) ); - connect( mActionRemoveAllFromOverview, SIGNAL( triggered() ), this, SLOT( removeAllFromOverview() ) ); - connect( mActionShowAllLayers, SIGNAL( triggered() ), this, SLOT( showAllLayers() ) ); - connect( mActionHideAllLayers, SIGNAL( triggered() ), this, SLOT( hideAllLayers() ) ); - connect( mActionShowSelectedLayers, SIGNAL( triggered() ), this, SLOT( showSelectedLayers() ) ); - connect( mActionHideSelectedLayers, SIGNAL( triggered() ), this, SLOT( hideSelectedLayers() ) ); + connect( mActionNewVectorLayer, &QAction::triggered, this, &QgisApp::newVectorLayer ); + connect( mActionNewSpatiaLiteLayer, &QAction::triggered, this, &QgisApp::newSpatialiteLayer ); + connect( mActionNewGeoPackageLayer, &QAction::triggered, this, &QgisApp::newGeoPackageLayer ); + connect( mActionNewMemoryLayer, &QAction::triggered, this, &QgisApp::newMemoryLayer ); + connect( mActionShowRasterCalculator, &QAction::triggered, this, &QgisApp::showRasterCalculator ); + connect( mActionShowAlignRasterTool, &QAction::triggered, this, &QgisApp::showAlignRasterTool ); + connect( mActionEmbedLayers, &QAction::triggered, this, &QgisApp::embedLayers ); + connect( mActionAddLayerDefinition, &QAction::triggered, this, &QgisApp::addLayerDefinition ); + connect( mActionAddOgrLayer, &QAction::triggered, this, [ = ] { addVectorLayer(); } ); + connect( mActionAddRasterLayer, &QAction::triggered, this, [ = ] { addRasterLayer(); } ); + connect( mActionAddPgLayer, &QAction::triggered, this, &QgisApp::addDatabaseLayer ); + connect( mActionAddSpatiaLiteLayer, &QAction::triggered, this, &QgisApp::addSpatiaLiteLayer ); + connect( mActionAddMssqlLayer, &QAction::triggered, this, &QgisApp::addMssqlLayer ); + connect( mActionAddDb2Layer, &QAction::triggered, this, &QgisApp::addDb2Layer ); + connect( mActionAddOracleLayer, &QAction::triggered, this, &QgisApp::addOracleLayer ); + connect( mActionAddWmsLayer, &QAction::triggered, this, &QgisApp::addWmsLayer ); + connect( mActionAddWcsLayer, &QAction::triggered, this, &QgisApp::addWcsLayer ); + connect( mActionAddWfsLayer, &QAction::triggered, this, [ = ] { addWfsLayer(); } ); + connect( mActionAddAfsLayer, &QAction::triggered, this, [ = ] { addAfsLayer(); } ); + connect( mActionAddAmsLayer, &QAction::triggered, this, [ = ] { addAmsLayer(); } ); + connect( mActionAddDelimitedText, &QAction::triggered, this, &QgisApp::addDelimitedTextLayer ); + connect( mActionAddVirtualLayer, &QAction::triggered, this, &QgisApp::addVirtualLayer ); + connect( mActionOpenTable, &QAction::triggered, this, &QgisApp::attributeTable ); + connect( mActionOpenFieldCalc, &QAction::triggered, this, &QgisApp::fieldCalculator ); + connect( mActionToggleEditing, &QAction::triggered, this, [ = ] { toggleEditing(); } ); + connect( mActionSaveLayerEdits, &QAction::triggered, this, &QgisApp::saveActiveLayerEdits ); + connect( mActionSaveEdits, &QAction::triggered, this, [ = ] { saveEdits(); } ); + connect( mActionSaveAllEdits, &QAction::triggered, this, &QgisApp::saveAllEdits ); + connect( mActionRollbackEdits, &QAction::triggered, this, &QgisApp::rollbackEdits ); + connect( mActionRollbackAllEdits, &QAction::triggered, this, &QgisApp::rollbackAllEdits ); + connect( mActionCancelEdits, &QAction::triggered, this, [ = ] { cancelEdits(); } ); + connect( mActionCancelAllEdits, &QAction::triggered, this, &QgisApp::cancelAllEdits ); + connect( mActionLayerSaveAs, &QAction::triggered, this, &QgisApp::saveAsFile ); + connect( mActionSaveLayerDefinition, &QAction::triggered, this, &QgisApp::saveAsLayerDefinition ); + connect( mActionRemoveLayer, &QAction::triggered, this, &QgisApp::removeLayer ); + connect( mActionDuplicateLayer, &QAction::triggered, this, [ = ] { duplicateLayers(); } ); + connect( mActionSetLayerScaleVisibility, &QAction::triggered, this, &QgisApp::setLayerScaleVisibility ); + connect( mActionSetLayerCRS, &QAction::triggered, this, &QgisApp::setLayerCrs ); + connect( mActionSetProjectCRSFromLayer, &QAction::triggered, this, &QgisApp::setProjectCrsFromLayer ); + connect( mActionLayerProperties, &QAction::triggered, this, &QgisApp::layerProperties ); + connect( mActionLayerSubsetString, &QAction::triggered, this, &QgisApp::layerSubsetString ); + connect( mActionAddToOverview, &QAction::triggered, this, &QgisApp::isInOverview ); + connect( mActionAddAllToOverview, &QAction::triggered, this, &QgisApp::addAllToOverview ); + connect( mActionRemoveAllFromOverview, &QAction::triggered, this, &QgisApp::removeAllFromOverview ); + connect( mActionShowAllLayers, &QAction::triggered, this, &QgisApp::showAllLayers ); + connect( mActionHideAllLayers, &QAction::triggered, this, &QgisApp::hideAllLayers ); + connect( mActionShowSelectedLayers, &QAction::triggered, this, &QgisApp::showSelectedLayers ); + connect( mActionHideSelectedLayers, &QAction::triggered, this, &QgisApp::hideSelectedLayers ); connect( mActionHideDeselectedLayers, &QAction::triggered, this, &QgisApp::hideDeselectedLayers ); // Plugin Menu Items - connect( mActionManagePlugins, SIGNAL( triggered() ), this, SLOT( showPluginManager() ) ); - connect( mActionInstallFromZip, SIGNAL( triggered() ), this, SLOT( installPluginFromZip() ) ); - connect( mActionShowPythonDialog, SIGNAL( triggered() ), this, SLOT( showPythonDialog() ) ); + connect( mActionManagePlugins, &QAction::triggered, this, &QgisApp::showPluginManager ); + connect( mActionInstallFromZip, &QAction::triggered, this, &QgisApp::installPluginFromZip ); + connect( mActionShowPythonDialog, &QAction::triggered, this, &QgisApp::showPythonDialog ); // Settings Menu Items - connect( mActionToggleFullScreen, SIGNAL( triggered() ), this, SLOT( toggleFullScreen() ) ); - connect( mActionTogglePanelsVisibility, SIGNAL( triggered() ), this, SLOT( togglePanelsVisibility() ) ); - connect( mActionProjectProperties, SIGNAL( triggered() ), this, SLOT( projectProperties() ) ); - connect( mActionOptions, SIGNAL( triggered() ), this, SLOT( options() ) ); - connect( mActionCustomProjection, SIGNAL( triggered() ), this, SLOT( customProjection() ) ); - connect( mActionConfigureShortcuts, SIGNAL( triggered() ), this, SLOT( configureShortcuts() ) ); - connect( mActionStyleManager, SIGNAL( triggered() ), this, SLOT( showStyleManager() ) ); - connect( mActionCustomization, SIGNAL( triggered() ), this, SLOT( customize() ) ); + connect( mActionToggleFullScreen, &QAction::triggered, this, &QgisApp::toggleFullScreen ); + connect( mActionTogglePanelsVisibility, &QAction::triggered, this, &QgisApp::togglePanelsVisibility ); + connect( mActionProjectProperties, &QAction::triggered, this, &QgisApp::projectProperties ); + connect( mActionOptions, &QAction::triggered, this, &QgisApp::options ); + connect( mActionCustomProjection, &QAction::triggered, this, &QgisApp::customProjection ); + connect( mActionConfigureShortcuts, &QAction::triggered, this, &QgisApp::configureShortcuts ); + connect( mActionStyleManager, &QAction::triggered, this, &QgisApp::showStyleManager ); + connect( mActionCustomization, &QAction::triggered, this, &QgisApp::customize ); #ifdef Q_OS_MAC // Window Menu Items @@ -1867,19 +1867,19 @@ void QgisApp::createActions() mActionAllEdits->setMenu( menuAllEdits ); // Raster toolbar items - connect( mActionLocalHistogramStretch, SIGNAL( triggered() ), this, SLOT( localHistogramStretch() ) ); - connect( mActionFullHistogramStretch, SIGNAL( triggered() ), this, SLOT( fullHistogramStretch() ) ); - connect( mActionLocalCumulativeCutStretch, SIGNAL( triggered() ), this, SLOT( localCumulativeCutStretch() ) ); - connect( mActionFullCumulativeCutStretch, SIGNAL( triggered() ), this, SLOT( fullCumulativeCutStretch() ) ); - connect( mActionIncreaseBrightness, SIGNAL( triggered() ), this, SLOT( increaseBrightness() ) ); - connect( mActionDecreaseBrightness, SIGNAL( triggered() ), this, SLOT( decreaseBrightness() ) ); - connect( mActionIncreaseContrast, SIGNAL( triggered() ), this, SLOT( increaseContrast() ) ); - connect( mActionDecreaseContrast, SIGNAL( triggered() ), this, SLOT( decreaseContrast() ) ); + connect( mActionLocalHistogramStretch, &QAction::triggered, this, &QgisApp::localHistogramStretch ); + connect( mActionFullHistogramStretch, &QAction::triggered, this, &QgisApp::fullHistogramStretch ); + connect( mActionLocalCumulativeCutStretch, &QAction::triggered, this, &QgisApp::localCumulativeCutStretch ); + connect( mActionFullCumulativeCutStretch, &QAction::triggered, this, &QgisApp::fullCumulativeCutStretch ); + connect( mActionIncreaseBrightness, &QAction::triggered, this, &QgisApp::increaseBrightness ); + connect( mActionDecreaseBrightness, &QAction::triggered, this, &QgisApp::decreaseBrightness ); + connect( mActionIncreaseContrast, &QAction::triggered, this, &QgisApp::increaseContrast ); + connect( mActionDecreaseContrast, &QAction::triggered, this, &QgisApp::decreaseContrast ); // Vector Menu Items - connect( mActionOSMDownload, SIGNAL( triggered() ), this, SLOT( osmDownloadDialog() ) ); - connect( mActionOSMImport, SIGNAL( triggered() ), this, SLOT( osmImportDialog() ) ); - connect( mActionOSMExport, SIGNAL( triggered() ), this, SLOT( osmExportDialog() ) ); + connect( mActionOSMDownload, &QAction::triggered, this, &QgisApp::osmDownloadDialog ); + connect( mActionOSMImport, &QAction::triggered, this, &QgisApp::osmImportDialog ); + connect( mActionOSMExport, &QAction::triggered, this, &QgisApp::osmExportDialog ); // Help Menu Items @@ -1891,23 +1891,23 @@ void QgisApp::createActions() mActionHelpContents->setEnabled( QFileInfo::exists( QgsApplication::pkgDataPath() + "/doc/index.html" ) ); - connect( mActionHelpContents, SIGNAL( triggered() ), this, SLOT( helpContents() ) ); - connect( mActionHelpAPI, SIGNAL( triggered() ), this, SLOT( apiDocumentation() ) ); - connect( mActionReportaBug, SIGNAL( triggered() ), this, SLOT( reportaBug() ) ); - connect( mActionNeedSupport, SIGNAL( triggered() ), this, SLOT( supportProviders() ) ); - connect( mActionQgisHomePage, SIGNAL( triggered() ), this, SLOT( helpQgisHomePage() ) ); - connect( mActionCheckQgisVersion, SIGNAL( triggered() ), this, SLOT( checkQgisVersion() ) ); - connect( mActionAbout, SIGNAL( triggered() ), this, SLOT( about() ) ); - connect( mActionSponsors, SIGNAL( triggered() ), this, SLOT( sponsors() ) ); + connect( mActionHelpContents, &QAction::triggered, this, &QgisApp::helpContents ); + connect( mActionHelpAPI, &QAction::triggered, this, &QgisApp::apiDocumentation ); + connect( mActionReportaBug, &QAction::triggered, this, &QgisApp::reportaBug ); + connect( mActionNeedSupport, &QAction::triggered, this, &QgisApp::supportProviders ); + connect( mActionQgisHomePage, &QAction::triggered, this, &QgisApp::helpQgisHomePage ); + connect( mActionCheckQgisVersion, &QAction::triggered, this, &QgisApp::checkQgisVersion ); + connect( mActionAbout, &QAction::triggered, this, &QgisApp::about ); + connect( mActionSponsors, &QAction::triggered, this, &QgisApp::sponsors ); - connect( mActionShowPinnedLabels, SIGNAL( toggled( bool ) ), this, SLOT( showPinnedLabels( bool ) ) ); - connect( mActionPinLabels, SIGNAL( triggered() ), this, SLOT( pinLabels() ) ); - connect( mActionShowHideLabels, SIGNAL( triggered() ), this, SLOT( showHideLabels() ) ); - connect( mActionMoveLabel, SIGNAL( triggered() ), this, SLOT( moveLabel() ) ); - connect( mActionRotateLabel, SIGNAL( triggered() ), this, SLOT( rotateLabel() ) ); - connect( mActionChangeLabelProperties, SIGNAL( triggered() ), this, SLOT( changeLabelProperties() ) ); + connect( mActionShowPinnedLabels, &QAction::toggled, this, &QgisApp::showPinnedLabels ); + connect( mActionPinLabels, &QAction::triggered, this, &QgisApp::pinLabels ); + connect( mActionShowHideLabels, &QAction::triggered, this, &QgisApp::showHideLabels ); + connect( mActionMoveLabel, &QAction::triggered, this, &QgisApp::moveLabel ); + connect( mActionRotateLabel, &QAction::triggered, this, &QgisApp::rotateLabel ); + connect( mActionChangeLabelProperties, &QAction::triggered, this, &QgisApp::changeLabelProperties ); - connect( mActionDiagramProperties, SIGNAL( triggered() ), this, SLOT( diagramProperties() ) ); + connect( mActionDiagramProperties, &QAction::triggered, this, &QgisApp::diagramProperties ); #ifndef HAVE_POSTGRESQL delete mActionAddPgLayer; @@ -2068,10 +2068,9 @@ void QgisApp::createMenus() // Project Menu // Connect once for the entire submenu. - connect( mRecentProjectsMenu, SIGNAL( triggered( QAction * ) ), - this, SLOT( openProject( QAction * ) ) ); - connect( mProjectFromTemplateMenu, SIGNAL( triggered( QAction * ) ), - this, SLOT( fileNewFromTemplateAction( QAction * ) ) ); + connect( mRecentProjectsMenu, &QMenu::triggered, this, static_cast < void ( QgisApp::* )( QAction *action ) >( &QgisApp::openProject ) ); + connect( mProjectFromTemplateMenu, &QMenu::triggered, + this, &QgisApp::fileNewFromTemplateAction ); if ( layout == QDialogButtonBox::GnomeLayout || layout == QDialogButtonBox::MacLayout || layout == QDialogButtonBox::WinLayout ) { @@ -2179,7 +2178,7 @@ void QgisApp::createToolBars() mSnappingWidget = new QgsSnappingWidget( QgsProject::instance(), mMapCanvas, mSnappingToolBar ); mSnappingWidget->setObjectName( QStringLiteral( "mSnappingWidget" ) ); - connect( mSnappingWidget, SIGNAL( snappingConfigChanged() ), QgsProject::instance(), SIGNAL( snappingConfigChanged() ) ); + connect( mSnappingWidget, &QgsSnappingWidget::snappingConfigChanged, QgsProject::instance(), [ = ] { QgsProject::instance()->setSnappingConfig( mSnappingWidget->config() ); } ); mSnappingToolBar->addWidget( mSnappingWidget ); mTracer = new QgsMapCanvasTracer( mMapCanvas, messageBar() ); @@ -2241,7 +2240,7 @@ void QgisApp::createToolBars() bt->setDefaultAction( defSelectAction ); QAction *selectAction = mAttributesToolBar->insertWidget( selectionAction, bt ); selectAction->setObjectName( QStringLiteral( "ActionSelect" ) ); - connect( bt, SIGNAL( triggered( QAction * ) ), this, SLOT( toolButtonActionTriggered( QAction * ) ) ); + connect( bt, &QToolButton::triggered, this, &QgisApp::toolButtonActionTriggered ); // feature action tool button @@ -2249,9 +2248,9 @@ void QgisApp::createToolBars() bt->setPopupMode( QToolButton::MenuButtonPopup ); bt->setDefaultAction( mActionFeatureAction ); mFeatureActionMenu = new QMenu( bt ); - connect( mFeatureActionMenu, SIGNAL( triggered( QAction * ) ), this, SLOT( updateDefaultFeatureAction( QAction * ) ) ); - connect( mFeatureActionMenu, SIGNAL( triggered( QAction * ) ), this, SLOT( doFeatureAction() ) ); - connect( mFeatureActionMenu, SIGNAL( aboutToShow() ), this, SLOT( refreshFeatureActions() ) ); + connect( mFeatureActionMenu, &QMenu::triggered, this, &QgisApp::updateDefaultFeatureAction ); + connect( mFeatureActionMenu, &QMenu::triggered, this, &QgisApp::doFeatureAction ); + connect( mFeatureActionMenu, &QMenu::aboutToShow, this, &QgisApp::refreshFeatureActions ); bt->setMenu( mFeatureActionMenu ); QAction *featureActionAction = mAttributesToolBar->insertWidget( selectAction, bt ); featureActionAction->setObjectName( QStringLiteral( "ActionFeatureAction" ) ); @@ -2280,7 +2279,7 @@ void QgisApp::createToolBars() bt->setDefaultAction( defMeasureAction ); QAction *measureAction = mAttributesToolBar->insertWidget( mActionMapTips, bt ); measureAction->setObjectName( QStringLiteral( "ActionMeasure" ) ); - connect( bt, SIGNAL( triggered( QAction * ) ), this, SLOT( toolButtonActionTriggered( QAction * ) ) ); + connect( bt, &QToolButton::triggered, this, &QgisApp::toolButtonActionTriggered ); // annotation tool button @@ -2315,7 +2314,7 @@ void QgisApp::createToolBars() bt->setDefaultAction( defAnnotationAction ); QAction *annotationAction = mAttributesToolBar->addWidget( bt ); annotationAction->setObjectName( QStringLiteral( "ActionAnnotation" ) ); - connect( bt, SIGNAL( triggered( QAction * ) ), this, SLOT( toolButtonActionTriggered( QAction * ) ) ); + connect( bt, &QToolButton::triggered, this, &QgisApp::toolButtonActionTriggered ); // vector layer edits tool buttons QToolButton *tbAllEdits = qobject_cast( mDigitizeToolBar->widgetForAction( mActionAllEdits ) ); @@ -2350,7 +2349,7 @@ void QgisApp::createToolBars() QAction *newLayerAction = mLayerToolBar->addWidget( bt ); newLayerAction->setObjectName( QStringLiteral( "ActionNewLayer" ) ); - connect( bt, SIGNAL( triggered( QAction * ) ), this, SLOT( toolButtonActionTriggered( QAction * ) ) ); + connect( bt, &QToolButton::triggered, this, &QgisApp::toolButtonActionTriggered ); // map service tool button bt = new QToolButton(); @@ -2371,7 +2370,7 @@ void QgisApp::createToolBars() QAction *mapServiceAction = mLayerToolBar->insertWidget( mActionAddWmsLayer, bt ); mLayerToolBar->removeAction( mActionAddWmsLayer ); mapServiceAction->setObjectName( QStringLiteral( "ActionMapService" ) ); - connect( bt, SIGNAL( triggered( QAction * ) ), this, SLOT( toolButtonActionTriggered( QAction * ) ) ); + connect( bt, &QToolButton::triggered, this, &QgisApp::toolButtonActionTriggered ); // feature service tool button bt = new QToolButton(); @@ -2392,7 +2391,7 @@ void QgisApp::createToolBars() QAction *featureServiceAction = mLayerToolBar->insertWidget( mActionAddWfsLayer, bt ); mLayerToolBar->removeAction( mActionAddWfsLayer ); featureServiceAction->setObjectName( QStringLiteral( "ActionFeatureService" ) ); - connect( bt, SIGNAL( triggered( QAction * ) ), this, SLOT( toolButtonActionTriggered( QAction * ) ) ); + connect( bt, &QToolButton::triggered, this, &QgisApp::toolButtonActionTriggered ); // add db layer button bt = new QToolButton(); @@ -2425,7 +2424,7 @@ void QgisApp::createToolBars() bt->setDefaultAction( defAddDbLayerAction ); QAction *addDbLayerAction = mLayerToolBar->insertWidget( mapServiceAction, bt ); addDbLayerAction->setObjectName( QStringLiteral( "ActionAddDbLayer" ) ); - connect( bt, SIGNAL( triggered( QAction * ) ), this, SLOT( toolButtonActionTriggered( QAction * ) ) ); + connect( bt, &QToolButton::triggered, this, &QgisApp::toolButtonActionTriggered ); QLayout *layout = mLayerToolBar->layout(); for ( int i = 0; i < layout->count(); ++i ) @@ -2439,7 +2438,7 @@ void QgisApp::createToolBars() tbAddCircularString->addAction( mActionCircularStringCurvePoint ); tbAddCircularString->addAction( mActionCircularStringRadius ); tbAddCircularString->setDefaultAction( mActionCircularStringCurvePoint ); - connect( tbAddCircularString, SIGNAL( triggered( QAction * ) ), this, SLOT( toolButtonActionTriggered( QAction * ) ) ); + connect( tbAddCircularString, &QToolButton::triggered, this, &QgisApp::toolButtonActionTriggered ); mDigitizeToolBar->insertWidget( mActionNodeTool, tbAddCircularString ); // move feature tool button @@ -2458,7 +2457,7 @@ void QgisApp::createToolBars() break; }; moveFeatureButton->setDefaultAction( defAction ); - connect( moveFeatureButton, SIGNAL( triggered( QAction * ) ), this, SLOT( toolButtonActionTriggered( QAction * ) ) ); + connect( moveFeatureButton, &QToolButton::triggered, this, &QgisApp::toolButtonActionTriggered ); mDigitizeToolBar->insertWidget( mActionNodeTool, moveFeatureButton ); bt = new QToolButton(); @@ -2479,7 +2478,7 @@ void QgisApp::createToolBars() bt->setDefaultAction( defPointSymbolAction ); QAction *pointSymbolAction = mAdvancedDigitizeToolBar->addWidget( bt ); pointSymbolAction->setObjectName( QStringLiteral( "ActionPointSymbolTools" ) ); - connect( bt, SIGNAL( triggered( QAction * ) ), this, SLOT( toolButtonActionTriggered( QAction * ) ) ); + connect( bt, &QToolButton::triggered, this, &QgisApp::toolButtonActionTriggered ); // Cad toolbar mAdvancedDigitizeToolBar->insertAction( mActionRotateFeature, mAdvancedDigitizingDockWidget->enableAction() ); @@ -2595,8 +2594,8 @@ void QgisApp::createStatusBar() "the project properties dialog to alter this behavior." ) ); mOnTheFlyProjectionStatusButton->setToolTip( tr( "CRS status - Click " "to open coordinate reference system dialog" ) ); - connect( mOnTheFlyProjectionStatusButton, SIGNAL( clicked() ), - this, SLOT( projectPropertiesProjections() ) );//bring up the project props dialog when clicked + connect( mOnTheFlyProjectionStatusButton, &QAbstractButton::clicked, + this, &QgisApp::projectPropertiesProjections );//bring up the project props dialog when clicked statusBar()->addPermanentWidget( mOnTheFlyProjectionStatusButton, 0 ); statusBar()->showMessage( tr( "Ready" ) ); @@ -2832,7 +2831,7 @@ void QgisApp::setTheme( const QString &themeName ) void QgisApp::setupConnections() { // connect the "cleanup" slot - connect( qApp, SIGNAL( aboutToQuit() ), this, SLOT( saveWindowState() ) ); + connect( qApp, &QApplication::aboutToQuit, this, &QgisApp::saveWindowState ); // signal when mouse moved over window (coords display in status bar) connect( mMapCanvas, &QgsMapCanvas::xyCoordinates, this, &QgisApp::saveLastMousePosition ); @@ -2879,65 +2878,63 @@ void QgisApp::setupConnections() } ); // connect legend signals - connect( mLayerTreeView, SIGNAL( currentLayerChanged( QgsMapLayer * ) ), - this, SLOT( activateDeactivateLayerRelatedActions( QgsMapLayer * ) ) ); - connect( mLayerTreeView, SIGNAL( currentLayerChanged( QgsMapLayer * ) ), - this, SLOT( setMapStyleDockLayer( QgsMapLayer * ) ) ); - - connect( mLayerTreeView->selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), - this, SLOT( legendLayerSelectionChanged() ) ); - connect( mLayerTreeView->layerTreeModel()->rootGroup(), SIGNAL( addedChildren( QgsLayerTreeNode *, int, int ) ), - this, SLOT( markDirty() ) ); - connect( mLayerTreeView->layerTreeModel()->rootGroup(), SIGNAL( addedChildren( QgsLayerTreeNode *, int, int ) ), - this, SLOT( updateNewLayerInsertionPoint() ) ); - connect( mLayerTreeView->layerTreeModel()->rootGroup(), SIGNAL( removedChildren( QgsLayerTreeNode *, int, int ) ), - this, SLOT( markDirty() ) ); - connect( mLayerTreeView->layerTreeModel()->rootGroup(), SIGNAL( removedChildren( QgsLayerTreeNode *, int, int ) ), - this, SLOT( updateNewLayerInsertionPoint() ) ); - connect( mLayerTreeView->layerTreeModel()->rootGroup(), SIGNAL( visibilityChanged( QgsLayerTreeNode * ) ), - this, SLOT( markDirty() ) ); - connect( mLayerTreeView->layerTreeModel()->rootGroup(), SIGNAL( customPropertyChanged( QgsLayerTreeNode *, QString ) ), - this, SLOT( markDirty() ) ); + connect( mLayerTreeView, &QgsLayerTreeView::currentLayerChanged, + this, &QgisApp::activateDeactivateLayerRelatedActions ); + connect( mLayerTreeView, &QgsLayerTreeView::currentLayerChanged, + this, &QgisApp::setMapStyleDockLayer ); + + connect( mLayerTreeView->selectionModel(), &QItemSelectionModel::selectionChanged, + this, &QgisApp::legendLayerSelectionChanged ); + connect( mLayerTreeView->layerTreeModel()->rootGroup(), &QgsLayerTreeNode::addedChildren, + this, &QgisApp::markDirty ); + connect( mLayerTreeView->layerTreeModel()->rootGroup(), &QgsLayerTreeNode::addedChildren, + this, &QgisApp::updateNewLayerInsertionPoint ); + connect( mLayerTreeView->layerTreeModel()->rootGroup(), &QgsLayerTreeNode::removedChildren, + this, &QgisApp::markDirty ); + connect( mLayerTreeView->layerTreeModel()->rootGroup(), &QgsLayerTreeNode::removedChildren, + this, &QgisApp::updateNewLayerInsertionPoint ); + connect( mLayerTreeView->layerTreeModel()->rootGroup(), &QgsLayerTreeNode::visibilityChanged, + this, &QgisApp::markDirty ); + connect( mLayerTreeView->layerTreeModel()->rootGroup(), &QgsLayerTreeNode::customPropertyChanged, + this, &QgisApp::markDirty ); // connect map layer registry - connect( QgsProject::instance(), SIGNAL( layersAdded( QList ) ), - this, SLOT( layersWereAdded( QList ) ) ); + connect( QgsProject::instance(), &QgsProject::layersAdded, + this, &QgisApp::layersWereAdded ); connect( QgsProject::instance(), - SIGNAL( layersWillBeRemoved( QStringList ) ), - this, SLOT( removingLayers( QStringList ) ) ); + static_cast < void ( QgsProject::* )( const QStringList & ) >( &QgsProject::layersWillBeRemoved ), + this, &QgisApp::removingLayers ); // connect initialization signal - connect( this, SIGNAL( initializationCompleted() ), - this, SLOT( fileOpenAfterLaunch() ) ); + connect( this, &QgisApp::initializationCompleted, + this, &QgisApp::fileOpenAfterLaunch ); // Connect warning dialog from project reading - connect( QgsProject::instance(), SIGNAL( oldProjectVersionWarning( QString ) ), - this, SLOT( oldProjectVersionWarning( QString ) ) ); - connect( QgsProject::instance(), SIGNAL( layerLoaded( int, int ) ), - this, SLOT( showProgress( int, int ) ) ); - connect( QgsProject::instance(), SIGNAL( loadingLayer( QString ) ), - this, SLOT( showStatusMessage( QString ) ) ); - connect( QgsProject::instance(), SIGNAL( readProject( const QDomDocument & ) ), - this, SLOT( readProject( const QDomDocument & ) ) ); - connect( QgsProject::instance(), SIGNAL( writeProject( QDomDocument & ) ), - this, SLOT( writeProject( QDomDocument & ) ) ); - - connect( QgsProject::instance(), SIGNAL( readProject( const QDomDocument & ) ), this, SLOT( loadComposersFromProject( const QDomDocument & ) ) ); - - connect( this, SIGNAL( projectRead() ), - this, SLOT( fileOpenedOKAfterLaunch() ) ); + connect( QgsProject::instance(), &QgsProject::oldProjectVersionWarning, + this, &QgisApp::oldProjectVersionWarning ); + connect( QgsProject::instance(), &QgsProject::layerLoaded, + this, &QgisApp::showProgress ); + connect( QgsProject::instance(), &QgsProject::loadingLayer, + this, &QgisApp::showStatusMessage ); + connect( QgsProject::instance(), &QgsProject::readProject, + this, &QgisApp::readProject ); + connect( QgsProject::instance(), &QgsProject::writeProject, + this, &QgisApp::writeProject ); + + connect( this, &QgisApp::projectRead, + this, &QgisApp::fileOpenedOKAfterLaunch ); connect( QgsProject::instance(), &QgsProject::transactionGroupsChanged, this, &QgisApp::onTransactionGroupsChanged ); // connect preview modes actions - connect( mActionPreviewModeOff, SIGNAL( triggered() ), this, SLOT( disablePreviewMode() ) ); - connect( mActionPreviewModeGrayscale, SIGNAL( triggered() ), this, SLOT( activateGrayscalePreview() ) ); - connect( mActionPreviewModeMono, SIGNAL( triggered() ), this, SLOT( activateMonoPreview() ) ); - connect( mActionPreviewProtanope, SIGNAL( triggered() ), this, SLOT( activateProtanopePreview() ) ); - connect( mActionPreviewDeuteranope, SIGNAL( triggered() ), this, SLOT( activateDeuteranopePreview() ) ); + connect( mActionPreviewModeOff, &QAction::triggered, this, &QgisApp::disablePreviewMode ); + connect( mActionPreviewModeGrayscale, &QAction::triggered, this, &QgisApp::activateGrayscalePreview ); + connect( mActionPreviewModeMono, &QAction::triggered, this, &QgisApp::activateMonoPreview ); + connect( mActionPreviewProtanope, &QAction::triggered, this, &QgisApp::activateProtanopePreview ); + connect( mActionPreviewDeuteranope, &QAction::triggered, this, &QgisApp::activateDeuteranopePreview ); // setup undo/redo actions - connect( mUndoWidget, SIGNAL( undoStackChanged() ), this, SLOT( updateUndoActions() ) ); + connect( mUndoWidget, &QgsUndoWidget::undoStackChanged, this, &QgisApp::updateUndoActions ); connect( mPrintComposersMenu, &QMenu::aboutToShow, this, &QgisApp::composerMenuAboutToShow ); connect( QgsProject::instance()->layoutManager(), &QgsLayoutManager::compositionAboutToBeRemoved, this, &QgisApp::compositionAboutToBeRemoved ); @@ -2954,8 +2951,8 @@ void QgisApp::createCanvasTools() mMapTools.mPan->setAction( mActionPan ); mMapTools.mIdentify = new QgsMapToolIdentifyAction( mMapCanvas ); mMapTools.mIdentify->setAction( mActionIdentify ); - connect( mMapTools.mIdentify, SIGNAL( copyToClipboard( QgsFeatureStore & ) ), - this, SLOT( copyFeatures( QgsFeatureStore & ) ) ); + connect( mMapTools.mIdentify, &QgsMapToolIdentifyAction::copyToClipboard, + this, &QgisApp::copyFeatures ); mMapTools.mFeatureAction = new QgsMapToolFeatureAction( mMapCanvas ); mMapTools.mFeatureAction->setAction( mActionFeatureAction ); mMapTools.mMeasureDist = new QgsMeasureTool( mMapCanvas, false /* area */ ); @@ -3285,17 +3282,17 @@ void QgisApp::initLayerTreeView() setupLayerTreeViewFromSettings(); - connect( mLayerTreeView, SIGNAL( doubleClicked( QModelIndex ) ), this, SLOT( layerTreeViewDoubleClicked( QModelIndex ) ) ); - connect( mLayerTreeView, SIGNAL( currentLayerChanged( QgsMapLayer * ) ), this, SLOT( activeLayerChanged( QgsMapLayer * ) ) ); - connect( mLayerTreeView->selectionModel(), SIGNAL( currentChanged( QModelIndex, QModelIndex ) ), this, SLOT( updateNewLayerInsertionPoint() ) ); - connect( QgsProject::instance()->layerTreeRegistryBridge(), SIGNAL( addedLayersToLayerTree( QList ) ), - this, SLOT( autoSelectAddedLayer( QList ) ) ); + connect( mLayerTreeView, &QAbstractItemView::doubleClicked, this, &QgisApp::layerTreeViewDoubleClicked ); + connect( mLayerTreeView, &QgsLayerTreeView::currentLayerChanged, this, &QgisApp::activeLayerChanged ); + connect( mLayerTreeView->selectionModel(), &QItemSelectionModel::currentChanged, this, &QgisApp::updateNewLayerInsertionPoint ); + connect( QgsProject::instance()->layerTreeRegistryBridge(), &QgsLayerTreeRegistryBridge::addedLayersToLayerTree, + this, &QgisApp::autoSelectAddedLayer ); // add group action QAction *actionAddGroup = new QAction( tr( "Add Group" ), this ); actionAddGroup->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddGroup.svg" ) ) ); actionAddGroup->setToolTip( tr( "Add Group" ) ); - connect( actionAddGroup, SIGNAL( triggered( bool ) ), mLayerTreeView->defaultActions(), SLOT( addGroup() ) ); + connect( actionAddGroup, &QAction::triggered, mLayerTreeView->defaultActions(), &QgsLayerTreeViewDefaultActions::addGroup ); // visibility groups tool button QToolButton *btnVisibilityPresets = new QToolButton; @@ -3310,28 +3307,28 @@ void QgisApp::initLayerTreeView() mActionFilterLegend->setCheckable( true ); mActionFilterLegend->setToolTip( tr( "Filter Legend By Map Content" ) ); mActionFilterLegend->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionFilter2.svg" ) ) ); - connect( mActionFilterLegend, SIGNAL( toggled( bool ) ), this, SLOT( updateFilterLegend() ) ); + connect( mActionFilterLegend, &QAction::toggled, this, &QgisApp::updateFilterLegend ); mLegendExpressionFilterButton = new QgsLegendFilterButton( this ); mLegendExpressionFilterButton->setToolTip( tr( "Filter legend by expression" ) ); - connect( mLegendExpressionFilterButton, SIGNAL( toggled( bool ) ), this, SLOT( toggleFilterLegendByExpression( bool ) ) ); + connect( mLegendExpressionFilterButton, &QAbstractButton::toggled, this, &QgisApp::toggleFilterLegendByExpression ); mActionStyleDock = new QAction( tr( "Layer Styling" ), this ); mActionStyleDock->setCheckable( true ); mActionStyleDock->setToolTip( tr( "Open the layer styling dock" ) ); mActionStyleDock->setShortcut( QStringLiteral( "F7" ) ); mActionStyleDock->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "propertyicons/symbology.svg" ) ) ); - connect( mActionStyleDock, SIGNAL( toggled( bool ) ), this, SLOT( mapStyleDock( bool ) ) ); + connect( mActionStyleDock, &QAction::toggled, this, &QgisApp::mapStyleDock ); // expand / collapse tool buttons QAction *actionExpandAll = new QAction( tr( "Expand All" ), this ); actionExpandAll->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionExpandTree.svg" ) ) ); actionExpandAll->setToolTip( tr( "Expand All" ) ); - connect( actionExpandAll, SIGNAL( triggered( bool ) ), mLayerTreeView, SLOT( expandAllNodes() ) ); + connect( actionExpandAll, &QAction::triggered, mLayerTreeView, &QgsLayerTreeView::expandAllNodes ); QAction *actionCollapseAll = new QAction( tr( "Collapse All" ), this ); actionCollapseAll->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionCollapseTree.svg" ) ) ); actionCollapseAll->setToolTip( tr( "Collapse All" ) ); - connect( actionCollapseAll, SIGNAL( triggered( bool ) ), mLayerTreeView, SLOT( collapseAllNodes() ) ); + connect( actionCollapseAll, &QAction::triggered, mLayerTreeView, &QgsLayerTreeView::collapseAllNodes ); QWidget *spacer = new QWidget(); spacer->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); @@ -3360,8 +3357,8 @@ void QgisApp::initLayerTreeView() addDockWidget( Qt::LeftDockWidgetArea, mLayerTreeDock ); mLayerTreeCanvasBridge = new QgsLayerTreeMapCanvasBridge( QgsProject::instance()->layerTreeRoot(), mMapCanvas, this ); - connect( QgsProject::instance(), SIGNAL( writeProject( QDomDocument & ) ), mLayerTreeCanvasBridge, SLOT( writeProject( QDomDocument & ) ) ); - connect( QgsProject::instance(), SIGNAL( readProject( QDomDocument ) ), mLayerTreeCanvasBridge, SLOT( readProject( QDomDocument ) ) ); + connect( QgsProject::instance(), &QgsProject::writeProject, mLayerTreeCanvasBridge, &QgsLayerTreeMapCanvasBridge::writeProject ); + connect( QgsProject::instance(), &QgsProject::readProject, mLayerTreeCanvasBridge, &QgsLayerTreeMapCanvasBridge::readProject ); mMapLayerOrder = new QgsCustomLayerOrderWidget( mLayerTreeCanvasBridge, this ); mMapLayerOrder->setObjectName( QStringLiteral( "theMapLayerOrder" ) ); @@ -3442,7 +3439,7 @@ void QgisApp::createMapTips() // Set up the timer for maptips. The timer is reset every time the mouse is moved mpMapTipsTimer = new QTimer( mMapCanvas ); // connect the timer to the maptips slot - connect( mpMapTipsTimer, SIGNAL( timeout() ), this, SLOT( showMapTip() ) ); + connect( mpMapTipsTimer, &QTimer::timeout, this, &QgisApp::showMapTip ); // set the interval to 0.850 seconds - timer will be started next time the mouse moves mpMapTipsTimer->setInterval( 850 ); mpMapTipsTimer->setSingleShot( true ); @@ -3454,16 +3451,16 @@ void QgisApp::createMapTips() void QgisApp::createDecorations() { QgsDecorationCopyright *mDecorationCopyright = new QgsDecorationCopyright( this ); - connect( mActionDecorationCopyright, SIGNAL( triggered() ), mDecorationCopyright, SLOT( run() ) ); + connect( mActionDecorationCopyright, &QAction::triggered, mDecorationCopyright, &QgsDecorationCopyright::run ); QgsDecorationNorthArrow *mDecorationNorthArrow = new QgsDecorationNorthArrow( this ); - connect( mActionDecorationNorthArrow, SIGNAL( triggered() ), mDecorationNorthArrow, SLOT( run() ) ); + connect( mActionDecorationNorthArrow, &QAction::triggered, mDecorationNorthArrow, &QgsDecorationNorthArrow::run ); QgsDecorationScaleBar *mDecorationScaleBar = new QgsDecorationScaleBar( this ); - connect( mActionDecorationScaleBar, SIGNAL( triggered() ), mDecorationScaleBar, SLOT( run() ) ); + connect( mActionDecorationScaleBar, &QAction::triggered, mDecorationScaleBar, &QgsDecorationScaleBar::run ); QgsDecorationGrid *mDecorationGrid = new QgsDecorationGrid( this ); - connect( mActionDecorationGrid, SIGNAL( triggered() ), mDecorationGrid, SLOT( run() ) ); + connect( mActionDecorationGrid, &QAction::triggered, mDecorationGrid, &QgsDecorationGrid::run ); // add the decorations in a particular order so they are rendered in that order addDecorationItem( mDecorationGrid ); @@ -3471,8 +3468,8 @@ void QgisApp::createDecorations() addDecorationItem( mDecorationNorthArrow ); addDecorationItem( mDecorationScaleBar ); connect( mMapCanvas, &QgsMapCanvas::renderComplete, this, &QgisApp::renderDecorationItems ); - connect( this, SIGNAL( newProject() ), this, SLOT( projectReadDecorationItems() ) ); - connect( this, SIGNAL( projectRead() ), this, SLOT( projectReadDecorationItems() ) ); + connect( this, &QgisApp::newProject, this, &QgisApp::projectReadDecorationItems ); + connect( this, &QgisApp::projectRead, this, &QgisApp::projectReadDecorationItems ); } void QgisApp::renderDecorationItems( QPainter *p ) @@ -4411,7 +4408,7 @@ void QgisApp::addDatabaseLayers( QStringList const &layerPathList, QString const QgsMessageLog::logMessage( tr( "%1 is an invalid layer - not loaded" ).arg( layerPath ) ); QLabel *msgLabel = new QLabel( tr( "%1 is an invalid layer and cannot be loaded. Please check the message log for further info." ).arg( layerPath ), messageBar() ); msgLabel->setWordWrap( true ); - connect( msgLabel, SIGNAL( linkActivated( QString ) ), mLogDock, SLOT( show() ) ); + connect( msgLabel, &QLabel::linkActivated, mLogDock, &QWidget::show ); QgsMessageBarItem *item = new QgsMessageBarItem( msgLabel, QgsMessageBar::WARNING ); messageBar()->pushItem( item ); delete layer; @@ -4635,8 +4632,8 @@ void QgisApp::addAfsLayer() return; } afss->setCurrentExtentAndCrs( mapCanvas()->extent(), mapCanvas()->mapSettings().destinationCrs() ); - connect( afss, SIGNAL( addLayer( QString, QString ) ), - this, SLOT( addAfsLayer( QString, QString ) ) ); + connect( afss, &QgsSourceSelectDialog::addLayer, + this, [ = ] { addAfsLayer(); } ); bool wasFrozen = mapCanvas()->isFrozen(); freezeCanvases(); @@ -4669,8 +4666,8 @@ void QgisApp::addAmsLayer() return; } amss->setCurrentExtentAndCrs( mapCanvas()->extent(), mapCanvas()->mapSettings().destinationCrs() ); - connect( amss, SIGNAL( addLayer( QString, QString ) ), - this, SLOT( addAmsLayer( QString, QString ) ) ); + connect( amss, &QgsSourceSelectDialog::addLayer, + this, [ = ] { addAmsLayer(); } ); bool wasFrozen = mapCanvas()->isFrozen(); freezeCanvases(); @@ -4892,8 +4889,8 @@ void QgisApp::fileOpenAfterLaunch() if ( mProjOpen == 0 ) // welcome page { - connect( this, SIGNAL( newProject() ), this, SLOT( showMapCanvas() ) ); - connect( this, SIGNAL( projectRead() ), this, SLOT( showMapCanvas() ) ); + connect( this, &QgisApp::newProject, this, &QgisApp::showMapCanvas ); + connect( this, &QgisApp::projectRead, this, &QgisApp::showMapCanvas ); return; } if ( mProjOpen == 1 && !mRecentProjects.isEmpty() ) // most recent project @@ -5021,7 +5018,7 @@ void QgisApp::newVectorLayer() { QLabel *msgLabel = new QLabel( tr( "Layer creation failed. Please check the message log for further information." ), messageBar() ); msgLabel->setWordWrap( true ); - connect( msgLabel, SIGNAL( linkActivated( QString ) ), mLogDock, SLOT( show() ) ); + connect( msgLabel, &QLabel::linkActivated, mLogDock, &QWidget::show ); QgsMessageBarItem *item = new QgsMessageBarItem( msgLabel, QgsMessageBar::WARNING ); messageBar()->pushItem( item ); } @@ -5684,7 +5681,7 @@ void QgisApp::showComposerManager() if ( !mComposerManager ) { mComposerManager = new QgsComposerManager( nullptr, Qt::Window ); - connect( mComposerManager, SIGNAL( finished( int ) ), this, SLOT( deleteComposerManager() ) ); + connect( mComposerManager, &QDialog::finished, this, &QgisApp::deleteComposerManager ); } mComposerManager->show(); mComposerManager->activate(); @@ -6238,7 +6235,7 @@ void QgisApp::labelingFontNotFound( QgsVectorLayer *vlayer, const QString &fontf btnOpenPrefs->addAction( act ); btnOpenPrefs->setDefaultAction( act ); btnOpenPrefs->setToolTip( QLatin1String( "" ) ); - connect( btnOpenPrefs, SIGNAL( triggered( QAction * ) ), this, SLOT( labelingDialogFontNotFound( QAction * ) ) ); + connect( btnOpenPrefs, &QToolButton::triggered, this, &QgisApp::labelingDialogFontNotFound ); // no timeout set, since notice needs attention and is only shown first time layer is labeled QgsMessageBarItem *fontMsg = new QgsMessageBarItem( @@ -6270,8 +6267,8 @@ void QgisApp::commitError( QgsVectorLayer *vlayer ) 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( @@ -6369,12 +6366,12 @@ void QgisApp::diagramProperties() dlg.setLayout( layout ); - connect( buttonBox->button( QDialogButtonBox::Ok ), SIGNAL( clicked() ), - &dlg, SLOT( accept() ) ); - connect( buttonBox->button( QDialogButtonBox::Cancel ), SIGNAL( clicked() ), - &dlg, SLOT( reject() ) ); - connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), - gui, SLOT( apply() ) ); + connect( buttonBox->button( QDialogButtonBox::Ok ), &QAbstractButton::clicked, + &dlg, &QDialog::accept ); + connect( buttonBox->button( QDialogButtonBox::Cancel ), &QAbstractButton::clicked, + &dlg, &QDialog::reject ); + connect( buttonBox->button( QDialogButtonBox::Apply ), &QAbstractButton::clicked, + gui, &QgsDiagramProperties::apply ); if ( dlg.exec() ) gui->apply(); @@ -9246,7 +9243,7 @@ void QgisApp::checkQgisVersion() QgsVersionInfo *versionInfo = new QgsVersionInfo(); QApplication::setOverrideCursor( Qt::WaitCursor ); - connect( versionInfo, SIGNAL( versionInfoAvailable() ), this, SLOT( versionReplyFinished() ) ); + connect( versionInfo, &QgsVersionInfo::versionInfoAvailable, this, &QgisApp::versionReplyFinished ); versionInfo->checkVersion(); } @@ -10568,9 +10565,9 @@ void QgisApp::mapToolChanged( QgsMapTool *newTool, QgsMapTool *oldTool ) { if ( oldTool ) { - disconnect( oldTool, SIGNAL( messageEmitted( QString ) ), this, SLOT( displayMapToolMessage( QString ) ) ); - disconnect( oldTool, SIGNAL( messageEmitted( QString, QgsMessageBar::MessageLevel ) ), this, SLOT( displayMapToolMessage( QString, QgsMessageBar::MessageLevel ) ) ); - disconnect( oldTool, SIGNAL( messageDiscarded() ), this, SLOT( removeMapToolMessage() ) ); + disconnect( oldTool, &QgsMapTool::messageEmitted, this, &QgisApp::displayMapToolMessage ); + disconnect( oldTool, &QgsMapTool::messageEmitted, this, &QgisApp::displayMapToolMessage ); + disconnect( oldTool, &QgsMapTool::messageDiscarded, this, &QgisApp::removeMapToolMessage ); } if ( newTool ) @@ -10580,9 +10577,9 @@ void QgisApp::mapToolChanged( QgsMapTool *newTool, QgsMapTool *oldTool ) mNonEditMapTool = newTool; } - connect( newTool, SIGNAL( messageEmitted( QString ) ), this, SLOT( displayMapToolMessage( QString ) ) ); - connect( newTool, SIGNAL( messageEmitted( QString, QgsMessageBar::MessageLevel ) ), this, SLOT( displayMapToolMessage( QString, QgsMessageBar::MessageLevel ) ) ); - connect( newTool, SIGNAL( messageDiscarded() ), this, SLOT( removeMapToolMessage() ) ); + connect( newTool, &QgsMapTool::messageEmitted, this, &QgisApp::displayMapToolMessage ); + connect( newTool, &QgsMapTool::messageEmitted, this, &QgisApp::displayMapToolMessage ); + connect( newTool, &QgsMapTool::messageDiscarded, this, &QgisApp::removeMapToolMessage ); } } @@ -10615,18 +10612,18 @@ void QgisApp::layersWereAdded( const QList &layers ) if ( vlayer ) { // notify user about any font family substitution, but only when rendering labels (i.e. not when opening settings dialog) - connect( vlayer, SIGNAL( labelingFontNotFound( QgsVectorLayer *, QString ) ), this, SLOT( labelingFontNotFound( QgsVectorLayer *, QString ) ) ); + connect( vlayer, &QgsVectorLayer::labelingFontNotFound, this, &QgisApp::labelingFontNotFound ); QgsVectorDataProvider *vProvider = vlayer->dataProvider(); if ( vProvider && vProvider->capabilities() & QgsVectorDataProvider::EditingCapabilities ) { - connect( vlayer, SIGNAL( layerModified() ), this, SLOT( updateLayerModifiedActions() ) ); - connect( vlayer, SIGNAL( editingStarted() ), this, SLOT( layerEditStateChanged() ) ); - connect( vlayer, SIGNAL( editingStopped() ), this, SLOT( layerEditStateChanged() ) ); + connect( vlayer, &QgsVectorLayer::layerModified, this, &QgisApp::updateLayerModifiedActions ); + connect( vlayer, &QgsVectorLayer::editingStarted, this, &QgisApp::layerEditStateChanged ); + connect( vlayer, &QgsVectorLayer::editingStopped, this, &QgisApp::layerEditStateChanged ); connect( vlayer, &QgsVectorLayer::readOnlyChanged, this, &QgisApp::layerEditStateChanged ); } - connect( vlayer, SIGNAL( raiseError( QString ) ), this, SLOT( onLayerError( QString ) ) ); + connect( vlayer, &QgsVectorLayer::raiseError, this, &QgisApp::onLayerError ); provider = vProvider; } @@ -10739,8 +10736,8 @@ void QgisApp::projectProperties() qApp->processEvents(); // Be told if the mouse display precision may have changed by the user // changing things in the project properties dialog box - connect( pp, SIGNAL( displayPrecisionChanged() ), this, - SLOT( updateMouseCoordinatePrecision() ) ); + connect( pp, &QgsProjectProperties::displayPrecisionChanged, this, + &QgisApp::updateMouseCoordinatePrecision ); connect( pp, &QgsProjectProperties::scalesChanged, mScaleWidget, &QgsStatusBarScaleWidget::updateScales ); @@ -11678,7 +11675,7 @@ void QgisApp::onTransactionGroupsChanged() { Q_FOREACH ( QgsTransactionGroup *tg, QgsProject::instance()->transactionGroups().values() ) { - connect( tg, SIGNAL( commitError( QString ) ), this, SLOT( displayMessage( QString, QString, QgsMessageBar::MessageLevel ) ), Qt::UniqueConnection ); + connect( tg, &QgsTransactionGroup::commitError, this, &QgisApp::transactionGroupCommitError, Qt::UniqueConnection ); } } @@ -11982,18 +11979,18 @@ void QgisApp::namSetup() { QgsNetworkAccessManager *nam = QgsNetworkAccessManager::instance(); - connect( nam, SIGNAL( authenticationRequired( QNetworkReply *, QAuthenticator * ) ), - this, SLOT( namAuthenticationRequired( QNetworkReply *, QAuthenticator * ) ) ); + connect( nam, &QNetworkAccessManager::authenticationRequired, + this, &QgisApp::namAuthenticationRequired ); - connect( nam, SIGNAL( proxyAuthenticationRequired( const QNetworkProxy &, QAuthenticator * ) ), - this, SLOT( namProxyAuthenticationRequired( const QNetworkProxy &, QAuthenticator * ) ) ); + connect( nam, &QNetworkAccessManager::proxyAuthenticationRequired, + this, &QgisApp::namProxyAuthenticationRequired ); - connect( nam, SIGNAL( requestTimedOut( QNetworkReply * ) ), - this, SLOT( namRequestTimedOut( QNetworkReply * ) ) ); + connect( nam, &QgsNetworkAccessManager::requestTimedOut, + this, &QgisApp::namRequestTimedOut ); #ifndef QT_NO_SSL - connect( nam, SIGNAL( sslErrors( QNetworkReply *, const QList & ) ), - this, SLOT( namSslErrors( QNetworkReply *, const QList & ) ) ); + connect( nam, &QNetworkAccessManager::sslErrors, + this, &QgisApp::namSslErrors ); #endif } @@ -12202,7 +12199,7 @@ void QgisApp::namRequestTimedOut( QNetworkReply *reply ) QLabel *msgLabel = new QLabel( tr( "A network request timed out, any data received is likely incomplete." ) + tr( " Please check the message log for further info." ), messageBar() ); msgLabel->setWordWrap( true ); - connect( msgLabel, SIGNAL( linkActivated( QString ) ), mLogDock, SLOT( show() ) ); + connect( msgLabel, &QLabel::linkActivated, mLogDock, &QWidget::show ); messageBar()->pushItem( new QgsMessageBarItem( msgLabel, QgsMessageBar::WARNING, messageTimeout() ) ); } @@ -12213,10 +12210,10 @@ void QgisApp::namUpdate() void QgisApp::masterPasswordSetup() { - connect( QgsAuthManager::instance(), SIGNAL( messageOut( const QString &, const QString &, QgsAuthManager::MessageLevel ) ), - this, SLOT( authMessageOut( const QString &, const QString &, QgsAuthManager::MessageLevel ) ) ); - connect( QgsAuthManager::instance(), SIGNAL( authDatabaseEraseRequested() ), - this, SLOT( eraseAuthenticationDatabase() ) ); + connect( QgsAuthManager::instance(), &QgsAuthManager::messageOut, + this, &QgisApp::authMessageOut ); + connect( QgsAuthManager::instance(), &QgsAuthManager::authDatabaseEraseRequested, + this, &QgisApp::eraseAuthenticationDatabase ); } void QgisApp::eraseAuthenticationDatabase() @@ -12455,6 +12452,11 @@ void QgisApp::tapAndHoldTriggered( QTapAndHoldGesture *gesture ) } } +void QgisApp::transactionGroupCommitError( const QString &error ) +{ + displayMessage( tr( "Transaction" ), error, QgsMessageBar::CRITICAL ); +} + #ifdef Q_OS_WIN LONG WINAPI QgisApp::qgisCrashDump( struct _EXCEPTION_POINTERS *ExceptionInfo ) { diff --git a/src/app/qgisapp.h b/src/app/qgisapp.h index a8583ef88f54..91dd15361708 100644 --- a/src/app/qgisapp.h +++ b/src/app/qgisapp.h @@ -68,6 +68,7 @@ class QgsMapOverviewCanvas; class QgsMapTip; class QgsMapTool; class QgsMapToolAdvancedDigitizing; +class QgsMapToolIdentifyAction; class QgsPluginLayer; class QgsPluginLayer; class QgsPluginManager; @@ -815,6 +816,8 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow void onTransactionGroupsChanged(); + void transactionGroupCommitError( const QString &error ); + void onSnappingConfigChanged(); //! validate a SRS @@ -1719,7 +1722,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow QgsMapTool *mZoomIn = nullptr; QgsMapTool *mZoomOut = nullptr; QgsMapTool *mPan = nullptr; - QgsMapTool *mIdentify = nullptr; + QgsMapToolIdentifyAction *mIdentify = nullptr; QgsMapTool *mFeatureAction = nullptr; QgsMapTool *mMeasureDist = nullptr; QgsMapTool *mMeasureArea = nullptr; diff --git a/src/gui/layertree/qgslayertreeviewdefaultactions.h b/src/gui/layertree/qgslayertreeviewdefaultactions.h index 32853e905bf8..0c9df7e8d1c1 100644 --- a/src/gui/layertree/qgslayertreeviewdefaultactions.h +++ b/src/gui/layertree/qgslayertreeviewdefaultactions.h @@ -71,9 +71,9 @@ class GUI_EXPORT QgsLayerTreeViewDefaultActions : public QObject public slots: void showInOverview(); + void addGroup(); protected slots: - void addGroup(); void removeGroupOrLayer(); void renameGroupOrLayer(); void showFeatureCount();