Commit 05852c3b authored by Nate Weibley's avatar Nate Weibley

Tweaks to mission editor model views. Helps to address #3456

parent c29de21a
......@@ -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
}
}
}
......
......@@ -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
}
*/
}
}
}
......
......@@ -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
......
......@@ -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
......
......@@ -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
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment