Commit 5977565f authored by DonLakeFlyer's avatar DonLakeFlyer

Fix bad redraw with Simple Mission Item editors

parent 8192004c
...@@ -15,7 +15,7 @@ import QGroundControl.Palette 1.0 ...@@ -15,7 +15,7 @@ import QGroundControl.Palette 1.0
/// Mission item edit control /// Mission item edit control
Rectangle { Rectangle {
id: _root id: _root
height: editorLoader.y + editorLoader.height + (_margin * 2) height: editorLoader.y + (editorLoader.visible ? editorLoader.height : 0) + (_margin * 2)
color: _currentItem ? qgcPal.missionItemEditor : qgcPal.windowShade color: _currentItem ? qgcPal.missionItemEditor : qgcPal.windowShade
radius: _radius radius: _radius
...@@ -198,12 +198,8 @@ Rectangle { ...@@ -198,12 +198,8 @@ Rectangle {
anchors.topMargin: _margin anchors.topMargin: _margin
anchors.left: parent.left anchors.left: parent.left
anchors.top: commandPicker.bottom anchors.top: commandPicker.bottom
height: item ? item.height : 0
source: missionItem.editorQml source: missionItem.editorQml
visible: _currentItem
onLoaded: {
item.visible = Qt.binding(function() { return _currentItem; })
}
property var masterController: _masterController property var masterController: _masterController
property real availableWidth: _root.width - (_margin * 2) ///< How wide the editor should be property real availableWidth: _root.width - (_margin * 2) ///< How wide the editor should be
......
...@@ -12,148 +12,130 @@ import QGroundControl.Palette 1.0 ...@@ -12,148 +12,130 @@ import QGroundControl.Palette 1.0
// Editor for Simple mission items // Editor for Simple mission items
Rectangle { Rectangle {
id: valuesRect width: availableWidth
width: availableWidth height: valuesColumn.height + _margin
height: deferedload.status == Loader.Ready ? (visible ? deferedload.item.height : 0) : 0 color: qgcPal.windowShadeDark
color: qgcPal.windowShadeDark radius: _radius
visible: missionItem.isCurrentItem
radius: _radius Column {
id: valuesColumn
Loader { anchors.margins: _margin
id: deferedload anchors.left: parent.left
active: valuesRect.visible anchors.right: parent.right
asynchronous: true anchors.top: parent.top
anchors.margins: _margin spacing: _margin
anchors.left: valuesRect.left
anchors.right: valuesRect.right QGCLabel {
anchors.top: valuesRect.top width: parent.width
wrapMode: Text.WordWrap
sourceComponent: Component { font.pointSize: ScreenTools.smallFontPointSize
Item { text: missionItem.rawEdit ?
id: valuesItem qsTr("Provides advanced access to all commands/parameters. Be very careful!") :
height: valuesColumn.height + (_margin * 2) missionItem.commandDescription
}
Column {
id: valuesColumn GridLayout {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top columns: 2
spacing: _margin
Repeater {
QGCLabel { model: missionItem.comboboxFacts
width: parent.width
wrapMode: Text.WordWrap QGCLabel {
font.pointSize: ScreenTools.smallFontPointSize text: object.name
text: missionItem.rawEdit ? visible: object.name != ""
qsTr("Provides advanced access to all commands/parameters. Be very careful!") : Layout.column: 0
missionItem.commandDescription Layout.row: index
} }
}
GridLayout {
anchors.left: parent.left Repeater {
anchors.right: parent.right model: missionItem.comboboxFacts
columns: 2
FactComboBox {
Repeater { indexModel: false
model: missionItem.comboboxFacts model: object.enumStrings
fact: object
QGCLabel { Layout.column: 1
text: object.name Layout.row: index
visible: object.name != "" Layout.fillWidth: true
Layout.column: 0 }
Layout.row: index }
} }
}
GridLayout {
Repeater { anchors.left: parent.left
model: missionItem.comboboxFacts anchors.right: parent.right
flow: GridLayout.TopToBottom
FactComboBox { rows: missionItem.textFieldFacts.count + missionItem.nanFacts.count + (missionItem.speedSection.available ? 1 : 0)
indexModel: false columns: 2
model: object.enumStrings
fact: object Repeater {
Layout.column: 1 model: missionItem.textFieldFacts
Layout.row: index
Layout.fillWidth: true QGCLabel { text: object.name }
} }
}
} Repeater {
model: missionItem.nanFacts
GridLayout {
anchors.left: parent.left QGCCheckBox {
anchors.right: parent.right text: object.name
flow: GridLayout.TopToBottom checked: !isNaN(object.rawValue)
rows: missionItem.textFieldFacts.count + missionItem.nanFacts.count + (missionItem.speedSection.available ? 1 : 0) onClicked: object.rawValue = checked ? 0 : NaN
columns: 2 }
}
Repeater {
model: missionItem.textFieldFacts QGCCheckBox {
id: flightSpeedCheckbox
QGCLabel { text: object.name } text: qsTr("Flight Speed")
} checked: missionItem.speedSection.specifyFlightSpeed
onClicked: missionItem.speedSection.specifyFlightSpeed = checked
Repeater { visible: missionItem.speedSection.available
model: missionItem.nanFacts }
QGCCheckBox { Repeater {
text: object.name model: missionItem.textFieldFacts
checked: !isNaN(object.rawValue)
onClicked: object.rawValue = checked ? 0 : NaN FactTextField {
} showUnits: true
} fact: object
Layout.fillWidth: true
QGCCheckBox { }
id: flightSpeedCheckbox }
text: qsTr("Flight Speed")
checked: missionItem.speedSection.specifyFlightSpeed Repeater {
onClicked: missionItem.speedSection.specifyFlightSpeed = checked model: missionItem.nanFacts
visible: missionItem.speedSection.available
} FactTextField {
showUnits: true
Repeater { fact: object
model: missionItem.textFieldFacts Layout.fillWidth: true
enabled: !isNaN(object.rawValue)
FactTextField { }
showUnits: true }
fact: object
Layout.fillWidth: true FactTextField {
} fact: missionItem.speedSection.flightSpeed
} Layout.fillWidth: true
enabled: flightSpeedCheckbox.checked
Repeater { visible: missionItem.speedSection.available
model: missionItem.nanFacts }
}
FactTextField {
showUnits: true Repeater {
fact: object model: missionItem.checkboxFacts
Layout.fillWidth: true
enabled: !isNaN(object.rawValue) FactCheckBox {
} text: object.name
} fact: object
}
FactTextField { }
fact: missionItem.speedSection.flightSpeed
Layout.fillWidth: true CameraSection {
enabled: flightSpeedCheckbox.checked checked: missionItem.cameraSection.settingsSpecified
visible: missionItem.speedSection.available visible: missionItem.cameraSection.available
} }
} } // Column
Repeater {
model: missionItem.checkboxFacts
FactCheckBox {
text: object.name
fact: object
}
}
CameraSection {
checked: missionItem.cameraSection.settingsSpecified
visible: missionItem.cameraSection.available
}
} // Column
} // Item
} // Component
} // Loader
} // Rectangle } // Rectangle
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