Skip to content
Permalink
Browse files

Re-add actionZoomToLayer

  • Loading branch information
TurboGraphxBeige authored and nyalldawson committed Jan 1, 2021
1 parent b176b4f commit e25d857a500186d5a88d469aee6ff366398dfce8
@@ -49,7 +49,19 @@ Action to uncheck a group and all its children
Action to check a group and all its parents
%End

QAction *actionZoomToLayer( QgsMapCanvas *canvas, QObject *parent = 0 ) /Factory/;
QAction *actionZoomToLayer( QgsMapCanvas *canvas, QObject *parent = 0 ) /Factory/;
%Docstring

.. deprecated:: QGIS 3.18
use actionZoomToLayers()
%End

QAction *actionZoomToLayers( QgsMapCanvas *canvas, QObject *parent = 0 ) /Factory/;
%Docstring
Action to zoom to all the selected layer(s) in the layer tree

.. versionadded:: 3.18
%End

QAction *actionZoomToSelection( QgsMapCanvas *canvas, QObject *parent = 0 ) /Factory/;
%Docstring
@@ -98,7 +110,21 @@ Action to enable/disable mutually exclusive flag of a group (only one child node
.. versionadded:: 2.12
%End

void zoomToLayer( QgsMapCanvas *canvas );
void zoomToLayer( QgsMapCanvas *canvas );
%Docstring

.. deprecated:: QGIS 3.18
use zoomToLayers()
%End

void zoomToLayers( QgsMapCanvas *canvas );
%Docstring
Zooms to all the selected layer(s) in the layer tree

.. seealso:: :py:func:`zoomToLayers`

.. versionadded:: 3.18
%End

void zoomToSelection( QgsMapCanvas *canvas );
%Docstring
@@ -117,7 +143,20 @@ Action to enable/disable mutually exclusive flag of a group (only one child node
void removeGroupOrLayer();
void renameGroupOrLayer();
void showFeatureCount();
void zoomToLayer();

void zoomToLayer();
%Docstring

.. deprecated:: QGIS 3.18
use zoomToLayers()
%End

void zoomToLayers();
%Docstring
Slot to zoom to all the selected layer(s) in the layer tree

.. versionadded:: 3.18
%End

void zoomToSelection();
%Docstring
@@ -516,6 +516,10 @@ Returns the native zoom full extent action. Call :py:func:`~QgisInterface.trigge
virtual QAction *actionZoomToLayer() = 0;
%Docstring
Returns the native zoom to layer action. Call :py:func:`~QgisInterface.trigger` on it to zoom to the active layer.
%End
virtual QAction *actionZoomToLayers() = 0;
%Docstring
Returns the native zoom to layers action. Call :py:func:`~QgisInterface.trigger` on it to zoom to the selected layers.
%End
virtual QAction *actionZoomToSelected() = 0;
%Docstring
@@ -2737,6 +2737,7 @@ void QgisApp::createActions()
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( mActionZoomToLayers, &QAction::triggered, this, &QgisApp::zoomToLayerExtent );
connect( mActionZoomToSelected, &QAction::triggered, this, &QgisApp::zoomToSelected );
connect( mActionZoomLast, &QAction::triggered, this, &QgisApp::zoomToPrevious );
@@ -4100,6 +4101,7 @@ void QgisApp::setTheme( const QString &themeName )
mActionPanToSelected->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionPanToSelected.svg" ) ) );
mActionZoomLast->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionZoomLast.svg" ) ) );
mActionZoomNext->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionZoomNext.svg" ) ) );
mActionZoomToLayer->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionZoomToLayer.svg" ) ) );
mActionZoomToLayers->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionZoomToLayer.svg" ) ) );
mActionZoomActualSize->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionZoomActual.svg" ) ) );
mActionIdentify->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionIdentify.svg" ) ) );
mActionDecreaseGamma->setEnabled( false );
mActionZoomActualSize->setEnabled( false );
mActionZoomToLayers->setEnabled( false );
mActionZoomToLayer->setEnabled( false );

enableDigitizeWithCurveAction( false );

mActionLayerProperties->setEnabled( QgsProject::instance()->layerIsEmbedded( layer->id() ).isEmpty() );
mActionAddToOverview->setEnabled( true );
mActionZoomToLayers->setEnabled( true );
mActionZoomToLayer->setEnabled( true );

mActionCopyStyle->setEnabled( true );
mActionPasteStyle->setEnabled( clipboard()->hasFormat( QStringLiteral( QGSCLIPBOARD_STYLE_MIME ) ) );
mActionIncreaseGamma->setEnabled( false );
mActionDecreaseGamma->setEnabled( false );
mActionZoomActualSize->setEnabled( false );
mActionZoomToLayer->setEnabled( isSpatial );
mActionZoomToLayers->setEnabled( isSpatial );
mActionZoomToSelected->setEnabled( isSpatial );
mActionLabeling->setEnabled( isSpatial );
mActionSelectFreehand->setEnabled( false );
mActionSelectRadius->setEnabled( false );
mActionZoomActualSize->setEnabled( true );
mActionZoomToLayer->setEnabled( true );
mActionZoomToLayers->setEnabled( true );
mActionZoomToSelected->setEnabled( false );
mActionOpenTable->setEnabled( false );
mActionSelectFreehand->setEnabled( false );
mActionSelectRadius->setEnabled( false );
mActionZoomActualSize->setEnabled( false );
mActionZoomToLayer->setEnabled( true );
mActionZoomToLayers->setEnabled( true );
mActionZoomToSelected->setEnabled( false );
mActionOpenTable->setEnabled( false );
mActionSelectFreehand->setEnabled( false );
mActionSelectRadius->setEnabled( false );
mActionZoomActualSize->setEnabled( false );
mActionZoomToLayer->setEnabled( true );
mActionZoomToLayers->setEnabled( true );
mActionZoomToSelected->setEnabled( false );
mActionOpenTable->setEnabled( false );
mActionSelectFreehand->setEnabled( false );
mActionSelectRadius->setEnabled( false );
mActionZoomActualSize->setEnabled( false );
mActionZoomToLayer->setEnabled( true );
mActionZoomToLayers->setEnabled( true );
mActionZoomToSelected->setEnabled( false );
mActionOpenTable->setEnabled( false );
@@ -509,6 +509,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
QAction *actionMeasure() { return mActionMeasure; }
QAction *actionMeasureArea() { return mActionMeasureArea; }
QAction *actionZoomFullExtent() { return mActionZoomFullExtent; }
QAction *actionZoomToLayer() { return mActionZoomToLayer; }
QAction *actionZoomToLayers() { return mActionZoomToLayers; }
QAction *actionZoomToSelected() { return mActionZoomToSelected; }
QAction *actionZoomLast() { return mActionZoomLast; }
@@ -700,6 +700,7 @@ QAction *QgisAppInterface::actionFeatureAction() { return qgis->actionFeatureAct
QAction *QgisAppInterface::actionMeasure() { return qgis->actionMeasure(); }
QAction *QgisAppInterface::actionMeasureArea() { return qgis->actionMeasureArea(); }
QAction *QgisAppInterface::actionZoomFullExtent() { return qgis->actionZoomFullExtent(); }
QAction *QgisAppInterface::actionZoomToLayer() { return qgis->actionZoomToLayer(); }
QAction *QgisAppInterface::actionZoomToLayers() { return qgis->actionZoomToLayers(); }
QAction *QgisAppInterface::actionZoomToSelected() { return qgis->actionZoomToSelected(); }
QAction *QgisAppInterface::actionZoomLast() { return qgis->actionZoomLast(); }
@@ -231,6 +231,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
QAction *actionMeasure() override;
QAction *actionMeasureArea() override;
QAction *actionZoomFullExtent() override;
QAction *actionZoomToLayer() override;
QAction *actionZoomToLayers() override;
QAction *actionZoomToSelected() override;
QAction *actionZoomLast() override;
@@ -476,6 +476,8 @@ class GUI_EXPORT QgisInterface : public QObject
//! Returns the native zoom full extent action. Call trigger() on it to zoom to the full extent.
virtual QAction *actionZoomFullExtent() = 0;
//! Returns the native zoom to layer action. Call trigger() on it to zoom to the active layer.
virtual QAction *actionZoomToLayer() = 0;
//! Returns the native zoom to layers action. Call trigger() on it to zoom to the selected layers.
virtual QAction *actionZoomToLayers() = 0;
//! Returns the native zoom to selected action. Call trigger() on it to zoom to the current selection.
virtual QAction *actionZoomToSelected() = 0;
@@ -1345,6 +1345,15 @@
<string>Ctrl+Shift+F</string>
</property>
</action>
<action name="mActionZoomToLayer">
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionZoomToLayer.svg</normaloff>:/images/themes/default/mActionZoomToLayer.svg</iconset>
</property>
<property name="text">
<string>Zoom to &amp;Layer</string>
</property>
</action>
<action name="mActionZoomToLayers">
<property name="icon">
<iconset resource="../../images/images.qrc">

0 comments on commit e25d857

Please sign in to comment.
You can’t perform that action at this time.