diff --git a/src/MissionEditor/MissionEditor.qml b/src/MissionEditor/MissionEditor.qml index fee394fbe512d093e03010076bd78aaecde84b4e..97b05a8539fcf41d1d54c841c324537269034d24 100644 --- a/src/MissionEditor/MissionEditor.qml +++ b/src/MissionEditor/MissionEditor.qml @@ -285,7 +285,6 @@ QGCView { if (addMissionItemsButton.checked) { var sequenceNumber = controller.insertSimpleMissionItem(coordinate, controller.visualItems.count) setCurrentItem(sequenceNumber) - editorListView.positionViewAtIndex(editorListView.count - 1, ListView.Contain) } else { editorMap.mapClicked(coordinate) } @@ -485,6 +484,8 @@ QGCView { model: controller.visualItems cacheBuffer: height * 2 clip: true + highlightMoveDuration: 250 + delegate: MissionItemEditor { missionItem: object @@ -499,11 +500,6 @@ QGCView { controller.removeMissionItem(index) } - onInsert: { - var sequenceNumber = controller.insertSimpleMissionItem(editorMap.center, i) - setCurrentItem(sequenceNumber) - } - onMoveHomeToMapCenter: controller.visualItems.get(0).coordinate = editorMap.center Connections { @@ -511,7 +507,7 @@ QGCView { onIsCurrentItemChanged: { if (object.isCurrentItem) { - editorListView.positionViewAtIndex(index, ListView.Contain) + editorListView.currentIndex = index } } } diff --git a/src/MissionEditor/MissionItemStatus.qml b/src/MissionEditor/MissionItemStatus.qml index b9753f8e00a420ae2560ad6ff366ed7f444d5d4a..4129df185c737349841bad06950359cbdb4da445 100644 --- a/src/MissionEditor/MissionItemStatus.qml +++ b/src/MissionEditor/MissionItemStatus.qml @@ -74,53 +74,43 @@ Rectangle { QGCLabel { text: _azimuthText } } - QGCFlickable { + ListView { + id: statusListView + model: missionItems + highlightMoveDuration: 250 anchors.leftMargin: _margins anchors.rightMargin: _margins anchors.top: parent.top anchors.bottom: parent.bottom - width: parent.width - valueGrid.width - (_margins * 2) - contentWidth: graphRow.width + orientation: ListView.Horizontal + spacing: ScreenTools.defaultFontPixelWidth * ScreenTools.smallFontPointRatio visible: _expanded + width: parent.width - valueGrid.width - (_margins * 2) clip: true + delegate: Item { + height: statusListView.height + width: indicator.width + visible: object.specifiesCoordinate && !object.isStandaloneCoordinate + + property real availableHeight: height - indicator.height + property bool graphAbsolute: true + + MissionItemIndexLabel { + id: indicator + anchors.horizontalCenter: parent.horizontalCenter + y: availableHeight - (availableHeight * object.altPercent) + small: true + isCurrentItem: object.isCurrentItem + label: object.abbreviation + visible: object.relativeAltitude ? true : (object.homePosition || graphAbsolute) + } + Connections { + target: object - Row { - id: graphRow - anchors.top: parent.top - anchors.bottom: parent.bottom - //anchors.margins: ScreenTools.defaultFontPixelWidth * ScreenTools.smallFontPointRatio - spacing: ScreenTools.defaultFontPixelWidth * ScreenTools.smallFontPointRatio - - Repeater { - model: missionItems - - Item { - height: graphRow.height - width: indicator.width - visible: object.specifiesCoordinate && !object.isStandaloneCoordinate - - property real availableHeight: height - indicator.height - property bool graphAbsolute: true - - MissionItemIndexLabel { - id: indicator - anchors.horizontalCenter: parent.horizontalCenter - y: availableHeight - (availableHeight * object.altPercent) - small: true - isCurrentItem: object.isCurrentItem - label: object.abbreviation - visible: object.relativeAltitude ? true : (object.homePosition || graphAbsolute) - } - - /* - Taking these off for now since there really isn't room for the numbers - QGCLabel { - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - font.pointSize: ScreenTools.smallFontPointSize - text: (object.relativeAltitude ? "" : "=") + object.coordinate.altitude.toFixed(0) + onIsCurrentItemChanged: { + if (object.isCurrentItem) { + statusListView.currentIndex = index } - */ } } } diff --git a/src/MissionEditor/SimpleItemEditor.qml b/src/MissionEditor/SimpleItemEditor.qml index f4d03a85ff632ea88f1f8b4b898cac5d2c049657..9f6a0172298ad30b30040a65c320589767548d9e 100644 --- a/src/MissionEditor/SimpleItemEditor.qml +++ b/src/MissionEditor/SimpleItemEditor.qml @@ -13,7 +13,7 @@ import QGroundControl.Palette 1.0 Rectangle { id: valuesRect width: availableWidth - height: valuesItem.height + height: visible ? valuesItem.height : 0 color: qgcPal.windowShadeDark visible: missionItem.isCurrentItem radius: _radius diff --git a/src/MissionEditor/SurveyItemEditor.qml b/src/MissionEditor/SurveyItemEditor.qml index e0d4a153f13cb9e4dc530caf219bb490cb22ebf3..61cd8d9a167e5f2f81279d47604ea95207d77fe8 100644 --- a/src/MissionEditor/SurveyItemEditor.qml +++ b/src/MissionEditor/SurveyItemEditor.qml @@ -10,7 +10,7 @@ import QGroundControl.Palette 1.0 // Editor for Survery mission items Rectangle { id: _root - height: editorColumn.height + (_margin * 2) + height: visible ? (editorColumn.height + (_margin * 2)) : 0 width: availableWidth color: qgcPal.windowShadeDark radius: _radius diff --git a/src/QmlControls/MissionItemEditor.qml b/src/QmlControls/MissionItemEditor.qml index 214c9b0b0d764d435a83a4d67b2af1289a78b08e..4f868d84242a2398cbc3a582a44fc860045c564a 100644 --- a/src/QmlControls/MissionItemEditor.qml +++ b/src/QmlControls/MissionItemEditor.qml @@ -151,9 +151,9 @@ Rectangle { anchors.topMargin: _margin anchors.left: parent.left anchors.top: commandPicker.bottom - height: _currentItem && item ? item.height : 0 - source: _currentItem ? (missionItem.isSimpleItem ? "qrc:/qml/SimpleItemEditor.qml" : "qrc:/qml/SurveyItemEditor.qml") : "" - + height: item ? item.height : 0 + source: missionItem.isSimpleItem ? "qrc:/qml/SimpleItemEditor.qml" : "qrc:/qml/SurveyItemEditor.qml" + onLoaded: { item.visible = Qt.binding(function() { return _currentItem; }) } property real availableWidth: _root.width - (_margin * 2) ///< How wide the editor should be property var editorRoot: _root }