Browse Source

Fix combobox usage

QGC4.4
Stefan Dunca 6 years ago
parent
commit
9e45ab3136
  1. 1
      src/AutoPilotPlugins/PX4/AirframeComponent.qml
  2. 10
      src/QmlControls/QGCComboBox.qml

1
src/AutoPilotPlugins/PX4/AirframeComponent.qml

@ -229,6 +229,7 @@ Your vehicle will also be restarted in order to complete the process.") @@ -229,6 +229,7 @@ Your vehicle will also be restarted in order to complete the process.")
anchors.left: parent.left
anchors.right: parent.right
model: modelData.airframes
textRole: "text"
Component.onCompleted: {
if (airframeCheckBox.checked) {

10
src/QmlControls/QGCComboBox.qml

@ -37,7 +37,15 @@ ComboBox { @@ -37,7 +37,15 @@ ComboBox {
width: control.width
contentItem: Text {
text: textRole ? modelData[textRole] : modelData
text: {
if(modelData) {
return textRole ? modelData[textRole] : modelData
}
else {
console.warn("ComboBox: no model data")
return ""
}
}
color: control.currentIndex === index ? qgcPal.buttonHighlightText : qgcPal.buttonText
verticalAlignment: Text.AlignVCenter
}

Loading…
Cancel
Save