Skip to content
Permalink
Browse files

Documentation improvements, add SIP_DEPRECATED annotations

  • Loading branch information
nyalldawson committed Jan 2, 2021
1 parent a1ee2ff commit 0d33fe4c99dec1531ccf2a76091d304d839e7119
@@ -49,8 +49,9 @@ 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,Deprecated/;
%Docstring
Action to zoom to the active layer from the layer tree.

.. deprecated:: QGIS 3.18
use actionZoomToLayers()
@@ -110,16 +111,17 @@ 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 ) /Deprecated/;
%Docstring
Zooms a map ``canvas`` to the extent of the active layer in the layer tree.

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

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

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

@@ -144,29 +146,30 @@ Zooms to all the selected layer(s) in the layer tree
void renameGroupOrLayer();
void showFeatureCount();

void zoomToLayer();
void zoomToLayer() /Deprecated/;
%Docstring
Zooms to the extent of the active layer in the layer tree.

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

void zoomToLayers();
%Docstring
Slot to zoom to all the selected layer(s) in the layer tree
Zooms to the combined extent of all the selected layer(s) in the layer tree.

.. versionadded:: 3.18
%End

void zoomToSelection();
%Docstring
Slot to zoom to selected features of a vector layer
Zooms to the bounding box of all selected features of a vector layer.

.. versionadded:: 3.2
%End
void zoomToGroup();

void makeTopLevel();
void makeTopLevel() /Deprecated/;
%Docstring

.. deprecated:: QGIS 3.2
@@ -513,14 +513,22 @@ Returns the native measure area action. Call :py:func:`~QgisInterface.trigger` o
%Docstring
Returns the native zoom full extent action. Call :py:func:`~QgisInterface.trigger` on it to zoom to the full extent.
%End
virtual QAction *actionZoomToLayer() = 0;

virtual QAction *actionZoomToLayer() = 0 /Deprecated/;
%Docstring
Returns the native zoom to layer action. Call :py:func:`~QgisInterface.trigger` on it to zoom to the active layer.

.. deprecated::
Use actionZoomToLayers() instead.
%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.

.. versionadded:: 3.18
%End

virtual QAction *actionZoomToSelected() = 0;
%Docstring
Returns the native zoom to selected action. Call :py:func:`~QgisInterface.trigger` on it to zoom to the current selection.
@@ -297,14 +297,13 @@ void QgsLayerTreeViewDefaultActions::zoomToLayer( QgsMapCanvas *canvas )
if ( !layer )
return;

QList<QgsMapLayer *> layers;
layers << layer;
const QList<QgsMapLayer *> layers { layer };
zoomToLayers( canvas, layers );
}

void QgsLayerTreeViewDefaultActions::zoomToLayers( QgsMapCanvas *canvas )
{
QList<QgsMapLayer *> layers = mView->selectedLayers();
const QList<QgsMapLayer *> layers = mView->selectedLayers();
if ( layers.isEmpty() )
return;

@@ -336,11 +335,13 @@ void QgsLayerTreeViewDefaultActions::zoomToGroup( QgsMapCanvas *canvas )

void QgsLayerTreeViewDefaultActions::zoomToLayer()
{
Q_NOWARN_DEPRECATED_PUSH
QAction *s = qobject_cast<QAction *>( sender() );
QgsMapCanvas *canvas = reinterpret_cast<QgsMapCanvas *>( s->data().value<void *>() );
QApplication::setOverrideCursor( Qt::WaitCursor );
zoomToLayer( canvas );
QApplication::restoreOverrideCursor();
Q_NOWARN_DEPRECATED_POP
}

void QgsLayerTreeViewDefaultActions::zoomToLayers()
@@ -58,9 +58,10 @@ class GUI_EXPORT QgsLayerTreeViewDefaultActions : public QObject
QAction *actionCheckAndAllParents( QObject *parent = nullptr );

/**
* Action to zoom to the active layer from the layer tree.
* \deprecated since QGIS 3.18, use actionZoomToLayers()
*/
Q_DECL_DEPRECATED QAction *actionZoomToLayer( QgsMapCanvas *canvas, QObject *parent = nullptr ) SIP_FACTORY;
Q_DECL_DEPRECATED QAction *actionZoomToLayer( QgsMapCanvas *canvas, QObject *parent = nullptr ) SIP_FACTORY SIP_DEPRECATED;

/**
* Action to zoom to all the selected layer(s) in the layer tree
@@ -106,12 +107,13 @@ class GUI_EXPORT QgsLayerTreeViewDefaultActions : public QObject
QAction *actionMutuallyExclusiveGroup( QObject *parent = nullptr ) SIP_FACTORY;

/**
* Zooms a map \a canvas to the extent of the active layer in the layer tree.
* \deprecated since QGIS 3.18, use zoomToLayers()
*/
Q_DECL_DEPRECATED void zoomToLayer( QgsMapCanvas *canvas );
Q_DECL_DEPRECATED void zoomToLayer( QgsMapCanvas *canvas ) SIP_DEPRECATED;

/**
* Zooms to all the selected layer(s) in the layer tree
* Zooms a map \a canvas to all the selected layer(s) in the layer tree
* \see zoomToLayers()
* \since QGIS 3.18
*/
@@ -134,18 +136,19 @@ class GUI_EXPORT QgsLayerTreeViewDefaultActions : public QObject
void showFeatureCount();

/**
* Zooms to the extent of the active layer in the layer tree.
* \deprecated since QGIS 3.18, use zoomToLayers()
*/
Q_DECL_DEPRECATED void zoomToLayer();
Q_DECL_DEPRECATED void zoomToLayer() SIP_DEPRECATED;

/**
* Slot to zoom to all the selected layer(s) in the layer tree
* Zooms to the combined extent of all the selected layer(s) in the layer tree.
* \since QGIS 3.18
*/
void zoomToLayers();

/**
* Slot to zoom to selected features of a vector layer
* Zooms to the bounding box of all selected features of a vector layer.
* \since QGIS 3.2
*/
void zoomToSelection();
@@ -154,7 +157,7 @@ class GUI_EXPORT QgsLayerTreeViewDefaultActions : public QObject
/**
* \deprecated since QGIS 3.2, use moveOutOfGroup()
*/
Q_DECL_DEPRECATED void makeTopLevel();
Q_DECL_DEPRECATED void makeTopLevel() SIP_DEPRECATED;

/**
* Moves selected layer(s) out of the group(s) and places this/these above the group(s)
@@ -475,10 +475,20 @@ class GUI_EXPORT QgisInterface : public QObject
virtual QAction *actionMeasureArea() = 0;
//! 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.

/**
* Returns the native zoom to layer action. Call trigger() on it to zoom to the active layer.
*
* \deprecated Use actionZoomToLayers() instead.
*/
Q_DECL_DEPRECATED virtual QAction *actionZoomToLayer() = 0 SIP_DEPRECATED;

/**
* Returns the native zoom to layers action. Call trigger() on it to zoom to the selected layers.
* \since QGIS 3.18
*/
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;
//! Returns the native zoom last action. Call trigger() on it to zoom to last.

0 comments on commit 0d33fe4

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