Skip to content

Commit

Permalink
MissionItemStatus: Make waypointValuesDisplay with variable width
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick José Pereira <[email protected]>
  • Loading branch information
patrickelectric committed Sep 25, 2017
1 parent b93d394 commit d2cc64c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/PlanView/MissionItemStatus.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0

Rectangle {
id: root
height: ScreenTools.defaultFontPixelHeight * 7
radius: ScreenTools.defaultFontPixelWidth * 0.5
color: qgcPal.window
Expand All @@ -27,8 +28,14 @@ Rectangle {

property var missionItems ///< List of all available mission items

property real maxWidth: parent.width
readonly property real _margins: ScreenTools.defaultFontPixelWidth

onMaxWidthChanged: {
var calcLength = (statusListView.count + 1)*statusListView.contentItem.children[0].width
root.width = root.maxWidth > calcLength ? calcLength : root.maxWidth
}

QGCPalette { id: qgcPal }

QGCLabel {
Expand Down Expand Up @@ -56,6 +63,11 @@ Rectangle {
clip: true
currentIndex: _currentMissionIndex

onCountChanged: {
var calcLength = (statusListView.count + 1)*statusListView.contentItem.children[0].width
root.width = root.maxWidth > calcLength ? calcLength : root.maxWidth
}

delegate: Item {
height: statusListView.height
width: display ? (indicator.width + spacing) : 0
Expand Down
2 changes: 1 addition & 1 deletion src/PlanView/PlanView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ QGCView {
id: waypointValuesDisplay
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.left: parent.left
anchors.right: rightPanel.left
maxWidth: parent.width - rightPanel.width - x
anchors.bottom: parent.bottom
missionItems: _missionController.visualItems
visible: _editingLayer === _layerMission && !ScreenTools.isShortScreen
Expand Down

0 comments on commit d2cc64c

Please sign in to comment.