mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-18 00:06:00 -04:00
Make function more readable
This commit is contained in:
parent
c79168a6bc
commit
9492c69d9f
@ -33,6 +33,21 @@ void QgsAppCanvasFiltering::setupElevationControllerAction( QAction *action, Qgs
|
|||||||
{
|
{
|
||||||
if ( 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();
|
QgsElevationControllerWidget *controller = new QgsElevationControllerWidget();
|
||||||
connect( controller, &QgsElevationControllerWidget::rangeChanged, canvas, &QgsMapCanvas::setZRange );
|
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 );
|
QAction *disableAction = new QAction( tr( "Disable Elevation Filter" ), controller );
|
||||||
controller->menu()->addAction( disableAction );
|
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 );
|
canvas->addOverlayWidget( controller, Qt::Edge::LeftEdge );
|
||||||
@ -74,14 +89,4 @@ void QgsAppCanvasFiltering::setupElevationControllerAction( QAction *action, Qgs
|
|||||||
QgsProject::instance()->elevationProperties()->setInvertElevationFilter( inverted );
|
QgsProject::instance()->elevationProperties()->setInvertElevationFilter( inverted );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
canvas->setZRange( QgsDoubleRange() );
|
|
||||||
if ( QgsElevationControllerWidget *controller = mCanvasElevationControllerMap.value( canvas ) )
|
|
||||||
{
|
|
||||||
controller->deleteLater();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,8 @@ class QgsAppCanvasFiltering : public QObject
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
void createElevationController( QAction *senderAction, QgsMapCanvas *canvas );
|
||||||
|
|
||||||
QHash< QgsMapCanvas *, QgsElevationControllerWidget * > mCanvasElevationControllerMap;
|
QHash< QgsMapCanvas *, QgsElevationControllerWidget * > mCanvasElevationControllerMap;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user