From c6c32ba6c28895390286d2cc7a62201f5b534bab Mon Sep 17 00:00:00 2001 From: DonLakeFlyer Date: Wed, 13 Nov 2019 11:51:16 -0800 Subject: [PATCH] Reword to use sizeToContents on combos for flight mode channels --- .../PX4/PX4SimpleFlightModes.qml | 53 +++++++++---------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/src/AutoPilotPlugins/PX4/PX4SimpleFlightModes.qml b/src/AutoPilotPlugins/PX4/PX4SimpleFlightModes.qml index 7a40d669d..06907c2f4 100644 --- a/src/AutoPilotPlugins/PX4/PX4SimpleFlightModes.qml +++ b/src/AutoPilotPlugins/PX4/PX4SimpleFlightModes.qml @@ -81,52 +81,49 @@ Item { height: flightModeColumn.height + ScreenTools.defaultFontPixelHeight color: qgcPal.windowShade - ColumnLayout { + GridLayout { id: flightModeColumn anchors.margins: ScreenTools.defaultFontPixelWidth anchors.left: parent.left anchors.top: parent.top - spacing: ScreenTools.defaultFontPixelHeight + rows: 7 + rowSpacing: ScreenTools.defaultFontPixelWidth / 2 + columnSpacing: rowSpacing + flow: GridLayout.TopToBottom - RowLayout { + QGCLabel { Layout.fillWidth: true - spacing: _margins + text: qsTr("Mode Channel") + } + + Repeater { + model: 6 QGCLabel { Layout.fillWidth: true - text: qsTr("Mode channel:") + text: qsTr("Flight Mode %1").arg(modelData + 1) + color: controller.activeFlightMode == index ? "yellow" : qgcPal.text } + } - FactComboBox { - Layout.preferredWidth: _channelComboWidth - fact: controller.getParameterFact(-1, "RC_MAP_FLTMODE") - indexModel: false - } + FactComboBox { + Layout.fillWidth: true + fact: controller.getParameterFact(-1, "RC_MAP_FLTMODE") + indexModel: false + sizeToContents: true } Repeater { model: 6 - RowLayout { + FactComboBox { Layout.fillWidth: true - spacing: ScreenTools.defaultFontPixelWidth - - property int index: modelData + 1 - - QGCLabel { - Layout.fillWidth: true - text: qsTr("Flight Mode %1").arg(index) - color: controller.activeFlightMode == index ? "yellow" : qgcPal.text - } - - FactComboBox { - Layout.preferredWidth: _channelComboWidth - fact: controller.getParameterFact(-1, "COM_FLTMODE" + index) - indexModel: false - } + fact: controller.getParameterFact(-1, "COM_FLTMODE" + (modelData + 1)) + indexModel: false + sizeToContents: true } - } // Repeater - Flight Modes - } // Column - Flight Modes + } + } } // Rectangle - Flight Modes } // Column - Flight mode settings -- 2.22.0