From d2d11f9741ed36ea416283f03cf8e14fef59e1dd Mon Sep 17 00:00:00 2001 From: Noah S Date: Wed, 17 Jun 2026 11:18:50 -0500 Subject: [PATCH] mission planning editing views toggle precedence fix --- src/PlanView/GeoFenceEditor.qml | 10 +++++++++- src/PlanView/PlanTreeView.qml | 17 +++++++++++++++++ src/PlanView/RallyPointItemEditor.qml | 5 +++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/PlanView/GeoFenceEditor.qml b/src/PlanView/GeoFenceEditor.qml index 2c2b0c05dc83..649d55e4d018 100644 --- a/src/PlanView/GeoFenceEditor.qml +++ b/src/PlanView/GeoFenceEditor.qml @@ -16,6 +16,10 @@ Rectangle { property var myGeoFenceController property var flightMap + /// Emitted when the user interacts with the editor, so the plan view can make + /// GeoFence the active editing layer (required for the map visuals to be interactive). + signal requestEditingLayer() + readonly property real _editFieldWidth: Math.min(width - _margin * 2, ScreenTools.defaultFontPixelWidth * 15) readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2 readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2 @@ -112,6 +116,7 @@ Rectangle { text: qsTr("Polygon Fence") onClicked: { + geoFenceEditorRect.requestEditingLayer() var rect = Qt.rect(flightMap.centerViewport.x, flightMap.centerViewport.y, flightMap.centerViewport.width, flightMap.centerViewport.height) var topLeftCoord = flightMap.toCoordinate(Qt.point(rect.x, rect.y), false /* clipToViewPort */) var bottomRightCoord = flightMap.toCoordinate(Qt.point(rect.x + rect.width, rect.y + rect.height), false /* clipToViewPort */) @@ -124,6 +129,7 @@ Rectangle { text: qsTr("Circular Fence") onClicked: { + geoFenceEditorRect.requestEditingLayer() var rect = Qt.rect(flightMap.centerViewport.x, flightMap.centerViewport.y, flightMap.centerViewport.width, flightMap.centerViewport.height) var topLeftCoord = flightMap.toCoordinate(Qt.point(rect.x, rect.y), false /* clipToViewPort */) var bottomRightCoord = flightMap.toCoordinate(Qt.point(rect.x + rect.width, rect.y + rect.height), false /* clipToViewPort */) @@ -183,6 +189,7 @@ Rectangle { on_InteractiveChanged: checked = _interactive onClicked: { + geoFenceEditorRect.requestEditingLayer() myGeoFenceController.clearAllInteractive() object.interactive = checked } @@ -223,7 +230,7 @@ Rectangle { anchors.right: parent.right columns: 4 flow: GridLayout.TopToBottom - visible: polygonSection.checked && myGeoFenceController.circles.count > 0 + visible: circleSection.checked && myGeoFenceController.circles.count > 0 QGCLabel { text: qsTr("Inclusion") @@ -259,6 +266,7 @@ Rectangle { on_InteractiveChanged: checked = _interactive onClicked: { + geoFenceEditorRect.requestEditingLayer() myGeoFenceController.clearAllInteractive() object.interactive = checked } diff --git a/src/PlanView/PlanTreeView.qml b/src/PlanView/PlanTreeView.qml index 329bd7b65366..2bcc06ea3dcc 100644 --- a/src/PlanView/PlanTreeView.qml +++ b/src/PlanView/PlanTreeView.qml @@ -285,8 +285,25 @@ TreeView { } onLoaded: { + if (delegateRoot.nodeType === "fenceEditor" && item) { + // Interacting with the GeoFence editor makes the fence the active + // editing layer so its map visuals become interactive. + item.requestEditingLayer.connect(function() { + root.editingLayerChangeRequested(root._layerFence) + }) + } + if (delegateRoot.nodeType === "rallyItem" && item) { + // Selecting a rally point makes Rally the active editing layer so its + // map visuals become interactive. + item.requestEditingLayer.connect(function() { + root.editingLayerChangeRequested(root._layerRally) + }) + } if (delegateRoot.nodeType === "missionItem" && item) { item.clicked.connect(function() { + // Selecting a mission item makes Mission the active editing layer so its + // map visuals (e.g. survey polygon tools) become interactive. + root.editingLayerChangeRequested(root._layerMission) root._missionController.setCurrentPlanViewSeqNum(delegateRoot.nodeObject.sequenceNumber, false) }) item.remove.connect(function() { diff --git a/src/PlanView/RallyPointItemEditor.qml b/src/PlanView/RallyPointItemEditor.qml index 7bcb0f46023c..63906f4b0581 100644 --- a/src/PlanView/RallyPointItemEditor.qml +++ b/src/PlanView/RallyPointItemEditor.qml @@ -15,6 +15,10 @@ Rectangle { property var rallyPoint ///< RallyPoint object associated with editor property var controller ///< RallyPointController + /// Emitted when the user interacts with the editor, so the plan view can make + /// Rally the active editing layer (required for the map visuals to be interactive). + signal requestEditingLayer() + property bool _currentItem: rallyPoint ? rallyPoint === controller.currentRallyPoint : false property color _outerTextColor: qgcPal.text @@ -58,6 +62,7 @@ Rectangle { anchors.right: titleLayout.right onClicked: { if (mainWindow.allowViewSwitch()) { + root.requestEditingLayer() controller.currentRallyPoint = rallyPoint } }