Skip to content
Permalink
Browse files

Only show Select and digitizing-based menus in the Edit menu

when appropriate (if not empty project and/or a compatible layer)

fixes #38470
  • Loading branch information
DelazJ authored and nyalldawson committed Sep 20, 2020
1 parent 9305e22 commit d5f27118dc4b1d90266429b91b13c9c1f4796e95
Showing with 15 additions and 0 deletions.
  1. +15 −0 src/app/qgisapp.cpp

if ( !layer )
{
menuSelect->setEnabled( false );
mActionSelectFeatures->setEnabled( false );
mActionSelectPolygon->setEnabled( false );
mActionSelectFreehand->setEnabled( false );
mActionAddFeature->setEnabled( false );
mActionCircularStringCurvePoint->setEnabled( false );
mActionCircularStringRadius->setEnabled( false );
mMenuCircle->setEnabled( false );
mActionCircle2Points->setEnabled( false );
mActionCircle3Points->setEnabled( false );
mActionCircle3Tangents->setEnabled( false );
mActionCircle2TangentsPoint->setEnabled( false );
mActionCircleCenterPoint->setEnabled( false );
mMenuEllipse->setEnabled( false );
mActionEllipseCenter2Points->setEnabled( false );
mActionEllipseCenterPoint->setEnabled( false );
mActionEllipseExtent->setEnabled( false );
mActionEllipseFoci->setEnabled( false );
mMenuRectangle->setEnabled( false );
mActionRectangleCenterPoint->setEnabled( false );
mActionRectangleExtent->setEnabled( false );
mActionRectangle3PointsDistance->setEnabled( false );
mActionRectangle3PointsProjected->setEnabled( false );
mMenuRegularPolygon->setEnabled( false );
mActionRegularPolygon2Points->setEnabled( false );
mActionRegularPolygonCenterPoint->setEnabled( false );
mActionRegularPolygonCenterCorner->setEnabled( false );
return;
}

menuSelect->setEnabled( true );

mActionLayerProperties->setEnabled( QgsProject::instance()->layerIsEmbedded( layer->id() ).isEmpty() );
mActionAddToOverview->setEnabled( true );
mActionZoomToLayer->setEnabled( true );
enableShapeTools = enableCircularTools;
mActionCircularStringCurvePoint->setEnabled( enableCircularTools );
mActionCircularStringRadius->setEnabled( enableCircularTools );
mMenuCircle->setEnabled( enableShapeTools );
mActionCircle2Points->setEnabled( enableShapeTools );
mActionCircle3Points->setEnabled( enableShapeTools );
mActionCircle3Tangents->setEnabled( enableShapeTools );
mActionCircle2TangentsPoint->setEnabled( enableShapeTools );
mActionCircleCenterPoint->setEnabled( enableShapeTools );
mMenuEllipse->setEnabled( enableShapeTools );
mActionEllipseCenter2Points->setEnabled( enableShapeTools );
mActionEllipseCenterPoint->setEnabled( enableShapeTools );
mActionEllipseExtent->setEnabled( enableShapeTools );
mActionEllipseFoci->setEnabled( enableShapeTools );
mMenuRectangle->setEnabled( enableShapeTools );
mActionRectangleCenterPoint->setEnabled( enableShapeTools );
mActionRectangleExtent->setEnabled( enableShapeTools );
mActionRectangle3PointsDistance->setEnabled( enableShapeTools );
mActionRectangle3PointsProjected->setEnabled( enableShapeTools );
mMenuRegularPolygon->setEnabled( enableShapeTools );
mActionRegularPolygon2Points->setEnabled( enableShapeTools );
mActionRegularPolygonCenterPoint->setEnabled( enableShapeTools );
mActionRegularPolygonCenterCorner->setEnabled( enableShapeTools );
mActionAddFeature->setEnabled( false );
mActionCircularStringCurvePoint->setEnabled( false );
mActionCircularStringRadius->setEnabled( false );
mMenuCircle->setEnabled( false );
mActionCircle2Points->setEnabled( false );
mActionCircle3Points->setEnabled( false );
mActionCircle3Tangents->setEnabled( false );
mActionCircle2TangentsPoint->setEnabled( false );
mActionCircleCenterPoint->setEnabled( false );
mMenuEllipse->setEnabled( false );
mActionEllipseCenter2Points->setEnabled( false );
mActionEllipseCenterPoint->setEnabled( false );
mActionEllipseExtent->setEnabled( false );
mActionEllipseFoci->setEnabled( false );
mMenuRectangle->setEnabled( false );
mActionRectangleCenterPoint->setEnabled( false );
mActionRectangleExtent->setEnabled( false );
mActionRectangle3PointsDistance->setEnabled( false );
mActionRectangle3PointsProjected->setEnabled( false );
mMenuRegularPolygon->setEnabled( false );
mActionRegularPolygon2Points->setEnabled( false );
mActionRegularPolygonCenterPoint->setEnabled( false );
mActionRegularPolygonCenterCorner->setEnabled( false );

0 comments on commit d5f2711

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