Skip to content
Permalink
Browse files

Cleaned some code, added API docs

  • Loading branch information
TurboGraphxBeige authored and nyalldawson committed Jan 1, 2021
1 parent 9fee766 commit b176b4f1119892123af5121f02e3d3d0a7e9678d
@@ -95,7 +95,7 @@ QgsMapCanvasDockWidget::QgsMapCanvasDockWidget( const QString &name, QWidget *pa
connect( mMapCanvas, &QgsMapCanvas::destinationCrsChanged, this, &QgsMapCanvasDockWidget::mapCrsChanged );
connect( mMapCanvas, &QgsMapCanvas::destinationCrsChanged, this, &QgsMapCanvasDockWidget::updateExtentRect );
connect( mActionZoomFullExtent, &QAction::triggered, mMapCanvas, &QgsMapCanvas::zoomToFullExtent );
connect( mActionZoomToLayer, &QAction::triggered, mMapCanvas, [ = ] { QgisApp::instance()->layerTreeView()->defaultActions()->zoomToLayer( mMapCanvas ); } );
connect( mActionZoomToLayers, &QAction::triggered, mMapCanvas, [ = ] { QgisApp::instance()->layerTreeView()->defaultActions()->zoomToLayers( mMapCanvas ); } );
connect( mActionZoomToSelected, &QAction::triggered, mMapCanvas, [ = ] { mMapCanvas->zoomToSelected(); } );
mapCrsChanged();

@@ -103,7 +103,7 @@ QAction *QgsLayerTreeViewDefaultActions::actionZoomToLayers( QgsMapCanvas *canva
{
QAction *a = new QAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionZoomToLayer.svg" ) ),
tr( "&Zoom to Layer(s)" ), parent );
a->setData( QVariant::fromValue( reinterpret_cast<void *>( canvas ) ) );
a->setData( QVariant::fromValue( canvas ) );
connect( a, &QAction::triggered, this, static_cast<void ( QgsLayerTreeViewDefaultActions::* )()>( &QgsLayerTreeViewDefaultActions::zoomToLayers ) );
return a;
}
@@ -346,7 +346,7 @@ void QgsLayerTreeViewDefaultActions::zoomToLayer()
void QgsLayerTreeViewDefaultActions::zoomToLayers()
{
QAction *s = qobject_cast<QAction *>( sender() );
QgsMapCanvas *canvas = reinterpret_cast<QgsMapCanvas *>( s->data().value<void *>() );
QgsMapCanvas *canvas = s->data().value<QgsMapCanvas *>();
QApplication::setOverrideCursor( Qt::WaitCursor );
zoomToLayers( canvas );
QApplication::restoreOverrideCursor();
@@ -62,6 +62,10 @@ class GUI_EXPORT QgsLayerTreeViewDefaultActions : public QObject
*/
Q_DECL_DEPRECATED QAction *actionZoomToLayer( QgsMapCanvas *canvas, QObject *parent = nullptr ) SIP_FACTORY;

/**
* Action to zoom to all the selected layer(s) in the layer tree
* \since QGIS 3.18
*/
QAction *actionZoomToLayers( QgsMapCanvas *canvas, QObject *parent = nullptr ) SIP_FACTORY;

/**
@@ -106,6 +110,11 @@ class GUI_EXPORT QgsLayerTreeViewDefaultActions : public QObject
*/
Q_DECL_DEPRECATED void zoomToLayer( QgsMapCanvas *canvas );

/**
* Zooms to all the selected layer(s) in the layer tree
* \see zoomToLayers()
* \since QGIS 3.18
*/
void zoomToLayers( QgsMapCanvas *canvas );

/**
@@ -129,6 +138,10 @@ class GUI_EXPORT QgsLayerTreeViewDefaultActions : public QObject
*/
Q_DECL_DEPRECATED void zoomToLayer();

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

/**

0 comments on commit b176b4f

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