Skip to content

Commit

Permalink
More old style connect removal
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 5, 2018
1 parent bf21ce4 commit 7b24bd3
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 71 deletions.
67 changes: 36 additions & 31 deletions src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,9 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
//! pastes group or layer from the clipboard to layer tree
void pasteLayer();

//! Apply the same style to selected layers or to current legend group
void applyStyleToGroup();

//! Sets CRS of a layer
void setLayerCrs();
//! Assign layer CRS to project
Expand Down Expand Up @@ -891,9 +894,23 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
//! layer selection changed
void legendLayerSelectionChanged();

/**
* Zooms so that the pixels of the raster layer occupies exactly one screen pixel.
Only works on raster layers*/
void legendLayerZoomNative();

/**
* Stretches the raster layer, if stretching is active, based on the min and max of the current extent.
Only works on raster layers*/
void legendLayerStretchUsingCurrentExtent();

//! Watch for QFileOpenEvent.
bool event( QEvent *event ) override;

//! Sets the CRS of the current legend group
void legendGroupSetCrs();
//! Sets the WMS data of the current legend group
void legendGroupSetWmsData();

/**
* \brief dataSourceManager Open the DataSourceManager dialog
Expand All @@ -902,6 +919,24 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
*/
void dataSourceManager( const QString &pageName = QString() );

//! Add a virtual layer
void addVirtualLayer();

//! Remove a layer from the map and legend
void removeLayer();

//! Duplicate map layer(s) in legend
void duplicateLayers( const QList<QgsMapLayer *> &lyrList = QList<QgsMapLayer *>() );

//! change layer subset of current vector layer
void layerSubsetString();

//! Sets scale visibility of selected layers
void setLayerScaleVisibility();

//! Zoom to nearest scale such that current layer is visible
void zoomToLayerScale();

/**
* Returns the shared application browser model.
*/
Expand Down Expand Up @@ -1061,8 +1096,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
void addSelectedVectorLayer( const QString &uri, const QString &layerName, const QString &provider );
//! Replace the selected layer by a vector layer defined by uri, layer name, data source uri
void replaceSelectedVectorLayer( const QString &oldId, const QString &uri, const QString &layerName, const QString &provider );
//! Add a virtual layer
void addVirtualLayer();

//! toggles whether the current selected layer is in overview or not
void isInOverview();
//! Store the position for map tool tip
Expand All @@ -1075,32 +1109,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
* \since QGIS 2.8
*/
void userRotation();
//! Remove a layer from the map and legend
void removeLayer();
//! Duplicate map layer(s) in legend
void duplicateLayers( const QList<QgsMapLayer *> &lyrList = QList<QgsMapLayer *>() );
//! Sets scale visibility of selected layers
void setLayerScaleVisibility();
//! Zoom to nearest scale such that current layer is visible
void zoomToLayerScale();

/**
* Zooms so that the pixels of the raster layer occupies exactly one screen pixel.
Only works on raster layers*/
void legendLayerZoomNative();

/**
* Stretches the raster layer, if stretching is active, based on the min and max of the current extent.
Only workds on raster layers*/
void legendLayerStretchUsingCurrentExtent();

//! Apply the same style to selected layers or to current legend group
void applyStyleToGroup();

//! Sets the CRS of the current legend group
void legendGroupSetCrs();
//! Sets the WMS data of the current legend group
void legendGroupSetWmsData();

//! zoom to extent of layer
void zoomToLayerExtent();
Expand Down Expand Up @@ -1459,9 +1467,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
//! Update gui actions/menus when layers are modified
void updateLayerModifiedActions();

//! change layer subset of current vector layer
void layerSubsetString();

//! map tool changed
void mapToolChanged( QgsMapTool *newTool, QgsMapTool *oldTool );

Expand Down
40 changes: 20 additions & 20 deletions src/app/qgsapplayertreeviewmenuprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
{
menu->addAction( actions->actionZoomToGroup( mCanvas, menu ) );

menu->addAction( tr( "Copy Group" ), QgisApp::instance(), SLOT( copyLayer() ) );
menu->addAction( tr( "Copy Group" ), QgisApp::instance(), &QgisApp::copyLayer );
if ( QgisApp::instance()->clipboard()->hasFormat( QGSCLIPBOARD_MAPLAYER_MIME ) )
{
QAction *actionPasteLayerOrGroup = new QAction( tr( "Paste Layer/Group" ), menu );
Expand All @@ -92,13 +92,13 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()

menu->addSeparator();
menu->addAction( actions->actionAddGroup( menu ) );
QAction *removeAction = menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionRemoveLayer.svg" ) ), tr( "&Remove Group…" ), QgisApp::instance(), SLOT( removeLayer() ) );
QAction *removeAction = menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionRemoveLayer.svg" ) ), tr( "&Remove Group…" ), QgisApp::instance(), &QgisApp::removeLayer );
removeAction->setEnabled( removeActionEnabled() );
menu->addSeparator();

menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionSetCRS.png" ) ),
tr( "&Set Group CRS…" ), QgisApp::instance(), SLOT( legendGroupSetCrs() ) );
menu->addAction( tr( "&Set Group WMS Data…" ), QgisApp::instance(), SLOT( legendGroupSetWmsData() ) );
tr( "&Set Group CRS…" ), QgisApp::instance(), &QgisApp::legendGroupSetCrs );
menu->addAction( tr( "&Set Group WMS Data…" ), QgisApp::instance(), &QgisApp::legendGroupSetWmsData );

menu->addSeparator();

Expand All @@ -120,7 +120,7 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()

if ( QgisApp::instance()->clipboard()->hasFormat( QGSCLIPBOARD_STYLE_MIME ) )
{
menu->addAction( tr( "Paste Style" ), QgisApp::instance(), SLOT( applyStyleToGroup() ) );
menu->addAction( tr( "Paste Style" ), QgisApp::instance(), &QgisApp::applyStyleToGroup );
}

menu->addSeparator();
Expand Down Expand Up @@ -161,23 +161,23 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()

if ( rlayer )
{
menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionZoomActual.svg" ) ), tr( "&Zoom to Native Resolution (100%)" ), QgisApp::instance(), SLOT( legendLayerZoomNative() ) );
menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionZoomActual.svg" ) ), tr( "&Zoom to Native Resolution (100%)" ), QgisApp::instance(), &QgisApp::legendLayerZoomNative );

if ( rlayer->rasterType() != QgsRasterLayer::Palette )
menu->addAction( tr( "&Stretch Using Current Extent" ), QgisApp::instance(), SLOT( legendLayerStretchUsingCurrentExtent() ) );
menu->addAction( tr( "&Stretch Using Current Extent" ), QgisApp::instance(), &QgisApp::legendLayerStretchUsingCurrentExtent );
}

addCustomLayerActions( menu, layer );
if ( layer && layer->type() == QgsMapLayer::VectorLayer && static_cast<QgsVectorLayer *>( layer )->providerType() == QLatin1String( "virtual" ) )
{
menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddVirtualLayer.svg" ) ), tr( "Edit Virtual Layer…" ), QgisApp::instance(), SLOT( addVirtualLayer() ) );
menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddVirtualLayer.svg" ) ), tr( "Edit Virtual Layer…" ), QgisApp::instance(), &QgisApp::addVirtualLayer );
}

menu->addSeparator();

// duplicate layer
QAction *duplicateLayersAction = menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionDuplicateLayer.svg" ) ), tr( "&Duplicate Layer" ), QgisApp::instance(), SLOT( duplicateLayers() ) );
QAction *removeAction = menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionRemoveLayer.svg" ) ), tr( "&Remove Layer…" ), QgisApp::instance(), SLOT( removeLayer() ) );
QAction *duplicateLayersAction = menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionDuplicateLayer.svg" ) ), tr( "&Duplicate Layer" ), QgisApp::instance(), [] { QgisApp::instance()->duplicateLayers(); } );
QAction *removeAction = menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionRemoveLayer.svg" ) ), tr( "&Remove Layer…" ), QgisApp::instance(), &QgisApp::removeLayer );
removeAction->setEnabled( removeActionEnabled() );

menu->addSeparator();
Expand Down Expand Up @@ -207,7 +207,7 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()

// attribute table
menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionOpenTable.svg" ) ), tr( "&Open Attribute Table" ),
QgisApp::instance(), SLOT( attributeTable() ) );
QgisApp::instance(), [ = ] { QgisApp::instance()->attributeTable(); } );

// allow editing
int cap = vlayer->dataProvider()->capabilities();
Expand All @@ -234,7 +234,7 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()

if ( vlayer->dataProvider()->supportsSubsetString() )
{
QAction *action = menu->addAction( tr( "&Filter…" ), QgisApp::instance(), SLOT( layerSubsetString() ) );
QAction *action = menu->addAction( tr( "&Filter…" ), QgisApp::instance(), &QgisApp::layerSubsetString );
action->setEnabled( !vlayer->isEditable() );
}
}
Expand All @@ -244,10 +244,10 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
if ( layer && layer->isSpatial() )
{
// set layer scale visibility
menu->addAction( tr( "&Set Layer Scale Visibility…" ), QgisApp::instance(), SLOT( setLayerScaleVisibility() ) );
menu->addAction( tr( "&Set Layer Scale Visibility…" ), QgisApp::instance(), &QgisApp::setLayerScaleVisibility );

if ( !layer->isInScaleRange( mCanvas->scale() ) )
menu->addAction( tr( "Zoom to &Visible Scale" ), QgisApp::instance(), SLOT( zoomToLayerScale() ) );
menu->addAction( tr( "Zoom to &Visible Scale" ), QgisApp::instance(), &QgisApp::zoomToLayerScale );

QMenu *menuSetCRS = new QMenu( tr( "Set CRS" ), menu );
// set layer crs
Expand Down Expand Up @@ -344,7 +344,7 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
}
else
{
menuStyleManager->addAction( tr( "Copy Style" ), app, SLOT( copyStyle() ) );
menuStyleManager->addAction( tr( "Copy Style" ), app, [ = ] { app->copyStyle(); } );
}

if ( layer && app->clipboard()->hasFormat( QGSCLIPBOARD_STYLE_MIME ) )
Expand Down Expand Up @@ -387,7 +387,7 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
}
else
{
menuStyleManager->addAction( tr( "Paste Style" ), app, SLOT( pasteStyle() ) );
menuStyleManager->addAction( tr( "Paste Style" ), app, [ = ] { app->pasteStyle(); } );
}
}

Expand Down Expand Up @@ -441,12 +441,12 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
{
if ( QgisApp::instance()->clipboard()->hasFormat( QGSCLIPBOARD_STYLE_MIME ) )
{
menu->addAction( tr( "Paste Style" ), QgisApp::instance(), SLOT( applyStyleToGroup() ) );
menu->addAction( tr( "Paste Style" ), QgisApp::instance(), &QgisApp::applyStyleToGroup );
}
}

if ( layer && QgsProject::instance()->layerIsEmbedded( layer->id() ).isEmpty() )
menu->addAction( tr( "&Properties…" ), QgisApp::instance(), SLOT( layerProperties() ) );
menu->addAction( tr( "&Properties…" ), QgisApp::instance(), &QgisApp::layerProperties );
}
}
else if ( QgsLayerTreeModelLegendNode *node = mView->layerTreeModel()->index2legendNode( idx ) )
Expand All @@ -457,9 +457,9 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
if ( symbolNode->flags() & Qt::ItemIsUserCheckable )
{
menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionShowAllLayers.svg" ) ), tr( "&Show All Items" ),
symbolNode, SLOT( checkAllItems() ) );
symbolNode, &QgsSymbolLegendNode::checkAllItems );
menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionHideAllLayers.svg" ) ), tr( "&Hide All Items" ),
symbolNode, SLOT( uncheckAllItems() ) );
symbolNode, &QgsSymbolLegendNode::uncheckAllItems );
menu->addSeparator();
}

Expand Down
34 changes: 17 additions & 17 deletions src/app/qgsidentifyresultsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1062,18 +1062,18 @@ void QgsIdentifyResultsDialog::contextMenuEvent( QContextMenuEvent *event )
mActionPopup->addAction(
QgsApplication::getThemeIcon( QStringLiteral( "/mActionFormView.svg" ) ),
vlayer->isEditable() ? tr( "Edit Feature Form…" ) : tr( "View Feature Form…" ),
this, SLOT( featureForm() ) );
this, &QgsIdentifyResultsDialog::featureForm );
}

if ( featItem->feature().isValid() )
{
mActionPopup->addAction( tr( "Zoom to Feature" ), this, SLOT( zoomToFeature() ) );
mActionPopup->addAction( tr( "Copy Feature" ), this, SLOT( copyFeature() ) );
mActionPopup->addAction( tr( "Toggle Feature Selection" ), this, SLOT( toggleFeatureSelection() ) );
mActionPopup->addAction( tr( "Zoom to Feature" ), this, &QgsIdentifyResultsDialog::zoomToFeature );
mActionPopup->addAction( tr( "Copy Feature" ), this, &QgsIdentifyResultsDialog::copyFeature );
mActionPopup->addAction( tr( "Toggle Feature Selection" ), this, &QgsIdentifyResultsDialog::toggleFeatureSelection );
}

mActionPopup->addAction( tr( "Copy Attribute Value" ), this, SLOT( copyAttributeValue() ) );
mActionPopup->addAction( tr( "Copy Feature Attributes" ), this, SLOT( copyFeatureAttributes() ) );
mActionPopup->addAction( tr( "Copy Attribute Value" ), this, &QgsIdentifyResultsDialog::copyAttributeValue );
mActionPopup->addAction( tr( "Copy Feature Attributes" ), this, &QgsIdentifyResultsDialog::copyFeatureAttributes );

if ( item->parent() == featItem && item->childCount() == 0 )
{
Expand All @@ -1086,26 +1086,26 @@ void QgsIdentifyResultsDialog::contextMenuEvent( QContextMenuEvent *event )
QTreeWidgetItem *layItem = layerItem( item );
if ( layItem && !layItem->data( 0, GetFeatureInfoUrlRole ).toString().isEmpty() )
{
mActionPopup->addAction( tr( "Copy GetFeatureInfo request URL" ), this, SLOT( copyGetFeatureInfoUrl() ) );
mActionPopup->addAction( tr( "Copy GetFeatureInfo request URL" ), this, &QgsIdentifyResultsDialog::copyGetFeatureInfoUrl );
}
}
if ( !mActionPopup->children().isEmpty() )
{
mActionPopup->addSeparator();
}

mActionPopup->addAction( tr( "Clear Results" ), this, SLOT( clear() ) );
mActionPopup->addAction( tr( "Clear Highlights" ), this, SLOT( clearHighlights() ) );
mActionPopup->addAction( tr( "Highlight All" ), this, SLOT( highlightAll() ) );
mActionPopup->addAction( tr( "Highlight Layer" ), this, SLOT( highlightLayer() ) );
mActionPopup->addAction( tr( "Clear Results" ), this, &QgsIdentifyResultsDialog::clear );
mActionPopup->addAction( tr( "Clear Highlights" ), this, &QgsIdentifyResultsDialog::clearHighlights );
mActionPopup->addAction( tr( "Highlight All" ), this, &QgsIdentifyResultsDialog::highlightAll );
mActionPopup->addAction( tr( "Highlight Layer" ), this, [ = ] { highlightLayer(); } );
if ( layer && QgsProject::instance()->layerIsEmbedded( layer->id() ).isEmpty() )
{
mActionPopup->addAction( tr( "Activate Layer" ), this, SLOT( activateLayer() ) );
mActionPopup->addAction( tr( "Layer Properties…" ), this, SLOT( layerProperties() ) );
mActionPopup->addAction( tr( "Activate Layer" ), this, [ = ] { activateLayer(); } );
mActionPopup->addAction( tr( "Layer Properties…" ), this, [ = ] { layerProperties(); } );
}
mActionPopup->addSeparator();
mActionPopup->addAction( tr( "Expand All" ), this, SLOT( expandAll() ) );
mActionPopup->addAction( tr( "Collapse All" ), this, SLOT( collapseAll() ) );
mActionPopup->addAction( tr( "Expand All" ), this, &QgsIdentifyResultsDialog::expandAll );
mActionPopup->addAction( tr( "Collapse All" ), this, &QgsIdentifyResultsDialog::collapseAll );
mActionPopup->addSeparator();

if ( featItem && vlayer )
Expand All @@ -1126,7 +1126,7 @@ void QgsIdentifyResultsDialog::contextMenuEvent( QContextMenuEvent *event )
continue;

QgsFeatureAction *a = new QgsFeatureAction( action.name(), mFeatures[ featIdx ], vlayer, action.id(), idx, this );
mActionPopup->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mAction.svg" ) ), action.name(), a, SLOT( execute() ) );
mActionPopup->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mAction.svg" ) ), action.name(), a, &QgsFeatureAction::execute );
}
}
}
Expand All @@ -1150,7 +1150,7 @@ void QgsIdentifyResultsDialog::contextMenuEvent( QContextMenuEvent *event )
continue;

QgsIdentifyResultsDialogMapLayerAction *a = new QgsIdentifyResultsDialogMapLayerAction( ( *actionIt )->text(), this, ( *actionIt ), vlayer, &( mFeatures[ featIdx ] ) );
mActionPopup->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mAction.svg" ) ), ( *actionIt )->text(), a, SLOT( execute() ) );
mActionPopup->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mAction.svg" ) ), ( *actionIt )->text(), a, &QgsIdentifyResultsDialogMapLayerAction::execute );
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsmapthemes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ QgsMapThemes::QgsMapThemes()

mReplaceMenu = new QMenu( tr( "Replace Theme" ) );
mMenu->addMenu( mReplaceMenu );
mActionAddPreset = mMenu->addAction( tr( "Add Theme…" ), this, SLOT( addPreset() ) );
mActionAddPreset = mMenu->addAction( tr( "Add Theme…" ), this, [ = ] { addPreset(); } );
mMenuSeparator = mMenu->addSeparator();

mActionRemoveCurrentPreset = mMenu->addAction( tr( "Remove Current Theme" ), this, SLOT( removeCurrentPreset() ) );
mActionRemoveCurrentPreset = mMenu->addAction( tr( "Remove Current Theme" ), this, &QgsMapThemes::removeCurrentPreset );

connect( mMenu, &QMenu::aboutToShow, this, &QgsMapThemes::menuAboutToShow );
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsmaptoolcircle2tangentspoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ void QgsMapToolCircle2TangentsPoint::createRadiusSpinBox()
mRadiusSpinBox->setValue( mRadius );
QgisApp::instance()->addUserInputWidget( mRadiusSpinBox );
mRadiusSpinBox->setFocus( Qt::TabFocusReason );
QObject::connect( mRadiusSpinBox, SIGNAL( valueChanged( int ) ), this, SLOT( radiusSpinBoxChanged( int ) ) );
QObject::connect( mRadiusSpinBox, qgis::overload< int >::of( &QgsSpinBox::valueChanged ), this, &QgsMapToolCircle2TangentsPoint::radiusSpinBoxChanged );
}

void QgsMapToolCircle2TangentsPoint::deleteRadiusSpinBox()
Expand Down

0 comments on commit 7b24bd3

Please sign in to comment.