diff --git a/src/MissionManager/QGCMapPolyline.h b/src/MissionManager/QGCMapPolyline.h index 34be94ba91e944f9f5eda87057b1473235e3066e..ac8ceab2315cbab7e69d4a13062c7d0ac2868d7f 100644 --- a/src/MissionManager/QGCMapPolyline.h +++ b/src/MissionManager/QGCMapPolyline.h @@ -32,6 +32,7 @@ public: Q_PROPERTY(bool interactive READ interactive WRITE setInteractive NOTIFY interactiveChanged) Q_PROPERTY(bool isValid READ isValid NOTIFY isValidChanged) Q_PROPERTY(bool empty READ empty NOTIFY isEmptyChanged) + Q_PROPERTY(bool traceMode MEMBER _traceMode NOTIFY traceModeChanged) Q_INVOKABLE void clear(void); Q_INVOKABLE void appendVertex(const QGeoCoordinate& coordinate); @@ -106,6 +107,7 @@ signals: void interactiveChanged (bool interactive); void isValidChanged (void); void isEmptyChanged (void); + void traceModeChanged (bool traceMode); private slots: void _polylineModelCountChanged(int count); @@ -123,4 +125,5 @@ private: bool _dirty; bool _interactive; bool _resetActive; + bool _traceMode = false; }; diff --git a/src/MissionManager/QGCMapPolylineVisuals.qml b/src/MissionManager/QGCMapPolylineVisuals.qml index 8756e0b651682765c04cbdebf0861e4f4121e08b..ad1d56f468f19e94ededde4bbb6af95f30e82241 100644 --- a/src/MissionManager/QGCMapPolylineVisuals.qml +++ b/src/MissionManager/QGCMapPolylineVisuals.qml @@ -32,7 +32,6 @@ Item { property var _dragHandlesComponent property var _splitHandlesComponent - property bool _traceMode: false property string _instructionText: _corridorToolsText property real _zorderDragHandle: QGroundControl.zOrderMapItems + 3 // Highest to prevent splitting when items overlap property real _zorderSplitHandle: QGroundControl.zOrderMapItems + 2 @@ -96,13 +95,16 @@ Item { } } - on_TraceModeChanged: { - if (_traceMode) { - _instructionText = _traceText - _objMgrTraceVisuals.createObject(traceMouseAreaComponent, mapControl, false) - } else { - _instructionText = _corridorToolsText - _objMgrTraceVisuals.destroyObjects() + Connections { + target: mapPolyline + onTraceModeChanged: { + if (mapPolyline.traceMode) { + _instructionText = _traceText + _objMgrTraceVisuals.createObject(traceMouseAreaComponent, mapControl, false) + } else { + _instructionText = _corridorToolsText + _objMgrTraceVisuals.destroyObjects() + } } } @@ -112,6 +114,7 @@ Item { _addInteractiveVisuals() } } + Component.onDestruction: mapPolyline.traceMode = false QGCDynamicObjectManager { id: _objMgrCommonVisuals } QGCDynamicObjectManager { id: _objMgrInteractiveVisuals } @@ -323,22 +326,22 @@ Item { QGCButton { _horizontalPadding: 0 text: qsTr("Basic") - visible: !_traceMode + visible: !mapPolyline.traceMode onClicked: _resetPolyline() } QGCButton { _horizontalPadding: 0 - text: _traceMode ? qsTr("Done Tracing") : qsTr("Trace") + text: mapPolyline.traceMode ? qsTr("Done Tracing") : qsTr("Trace") onClicked: { - if (_traceMode) { + if (mapPolyline.traceMode) { if (mapPolyline.count < 2) { _restorePreviousVertices() } - _traceMode = false + mapPolyline.traceMode = false } else { _saveCurrentVertices() - _traceMode = true + mapPolyline.traceMode = true mapPolyline.clear(); } } @@ -348,7 +351,7 @@ Item { _horizontalPadding: 0 text: qsTr("Load KML...") onClicked: kmlLoadDialog.openForLoad() - visible: !_traceMode + visible: !mapPolyline.traceMode } } } diff --git a/src/PlanView/CorridorScanEditor.qml b/src/PlanView/CorridorScanEditor.qml index f47c521919ff67d2cf83194ad9aac84a6bac8f24..78f18e35e0e4c70d275c1eacfb564fa7a3e94b86 100644 --- a/src/PlanView/CorridorScanEditor.qml +++ b/src/PlanView/CorridorScanEditor.qml @@ -71,7 +71,7 @@ Rectangle { QGCButton { text: qsTr("Done With Polyline") Layout.fillWidth: true - enabled: missionItem.corridorPolyline.isValid + enabled: missionItem.corridorPolyline.isValid && !missionItem.corridorPolyline.traceMode onClicked: { missionItem.wizardMode = false editorRoot.selectNextNotReadyItem() diff --git a/src/PlanView/StructureScanEditor.qml b/src/PlanView/StructureScanEditor.qml index c8a8611477410cf7129e0ab4f8aea33bd9820599..09ccf281d94403bd0029f287662958522feb2584 100644 --- a/src/PlanView/StructureScanEditor.qml +++ b/src/PlanView/StructureScanEditor.qml @@ -72,7 +72,7 @@ Rectangle { QGCButton { text: qsTr("Done With Polygon") Layout.fillWidth: true - enabled: missionItem.structurePolygon.isValid + enabled: missionItem.structurePolygon.isValid && !missionItem.structurePolygon.traceMode onClicked: { missionItem.wizardMode = false editorRoot.selectNextNotReadyItem()