mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-15 00:02:52 -04:00
Make function more readable
This commit is contained in:
parent
c79168a6bc
commit
9492c69d9f
@ -32,6 +32,21 @@ void QgsAppCanvasFiltering::setupElevationControllerAction( QAction *action, Qgs
|
||||
connect( action, &QAction::toggled, canvas, [canvas, action, this]( bool checked )
|
||||
{
|
||||
if ( checked )
|
||||
{
|
||||
createElevationController( action, canvas );
|
||||
}
|
||||
else
|
||||
{
|
||||
canvas->setZRange( QgsDoubleRange() );
|
||||
if ( QgsElevationControllerWidget *controller = mCanvasElevationControllerMap.value( canvas ) )
|
||||
{
|
||||
controller->deleteLater();
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
void QgsAppCanvasFiltering::createElevationController( QAction *senderAction, QgsMapCanvas *canvas )
|
||||
{
|
||||
QgsElevationControllerWidget *controller = new QgsElevationControllerWidget();
|
||||
connect( controller, &QgsElevationControllerWidget::rangeChanged, canvas, &QgsMapCanvas::setZRange );
|
||||
@ -44,9 +59,9 @@ void QgsAppCanvasFiltering::setupElevationControllerAction( QAction *action, Qgs
|
||||
} );
|
||||
QAction *disableAction = new QAction( tr( "Disable Elevation Filter" ), controller );
|
||||
controller->menu()->addAction( disableAction );
|
||||
connect( disableAction, &QAction::triggered, action, [action]
|
||||
connect( disableAction, &QAction::triggered, senderAction, [senderAction]
|
||||
{
|
||||
action->setChecked( false );
|
||||
senderAction->setChecked( false );
|
||||
} );
|
||||
|
||||
canvas->addOverlayWidget( controller, Qt::Edge::LeftEdge );
|
||||
@ -75,13 +90,3 @@ void QgsAppCanvasFiltering::setupElevationControllerAction( QAction *action, Qgs
|
||||
} );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
canvas->setZRange( QgsDoubleRange() );
|
||||
if ( QgsElevationControllerWidget *controller = mCanvasElevationControllerMap.value( canvas ) )
|
||||
{
|
||||
controller->deleteLater();
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
@ -36,6 +36,8 @@ class QgsAppCanvasFiltering : public QObject
|
||||
|
||||
private:
|
||||
|
||||
void createElevationController( QAction *senderAction, QgsMapCanvas *canvas );
|
||||
|
||||
QHash< QgsMapCanvas *, QgsElevationControllerWidget * > mCanvasElevationControllerMap;
|
||||
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user