Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Cleaned some code, added API docs
- Loading branch information
|
@@ -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(); |
|
|
|
|
|
/** |
|
|