From 31d4efc3767f2747de7f414f4b057a22f7c6108b Mon Sep 17 00:00:00 2001 From: Valentin Platzgummer Date: Tue, 15 Dec 2020 15:37:27 +0100 Subject: [PATCH] alt stuff added to MeasurementComplexItem --- .../qml/AreaDataEditor.qml | 4 +- .../qml/ParameterEditor.qml | 52 ++++++++++++------- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/src/MeasurementComplexItem/qml/AreaDataEditor.qml b/src/MeasurementComplexItem/qml/AreaDataEditor.qml index e2042ab51..52c43cd30 100644 --- a/src/MeasurementComplexItem/qml/AreaDataEditor.qml +++ b/src/MeasurementComplexItem/qml/AreaDataEditor.qml @@ -16,7 +16,6 @@ GridLayout { property var _areaData: missionItem.areaData property real _margin: ScreenTools.defaultFontPixelWidth / 2 - width: availableWidth columnSpacing: _margin rowSpacing: _margin columns: 2 @@ -58,12 +57,15 @@ GridLayout { ColumnLayout { id:editorParent Layout.fillWidth: true + Layout.maximumWidth: parent.width Layout.columnSpan: 2 } Repeater{ id:areaEditorRepeater + Layout.maximumWidth: parent.width + model: _missionItem.areaData.areaList delegate: Item{ id:editor diff --git a/src/MeasurementComplexItem/qml/ParameterEditor.qml b/src/MeasurementComplexItem/qml/ParameterEditor.qml index b7ddbad1c..f322fcf69 100644 --- a/src/MeasurementComplexItem/qml/ParameterEditor.qml +++ b/src/MeasurementComplexItem/qml/ParameterEditor.qml @@ -14,18 +14,21 @@ import QGroundControl.FactControls 1.0 import QGroundControl.Palette 1.0 import QGroundControl.FlightMap 1.0 -ColumnLayout { - id:root +GridLayout { + id:_root - property int availableWidth: 300 - property var missionItem: undefined ///< Mission Item for editor property bool checked: true + property var missionItem: undefined + property int availableWidth: 300 property real _margin: ScreenTools.defaultFontPixelWidth / 2 property var _generator: missionItem.generator property var _generatorEditor: undefined - width: availableWidth + width: availableWidth + columnSpacing: _margin + rowSpacing: _margin + columns: 2 Component.onCompleted: { console.assert(missionItem !== undefined, "please set the missionItem property") @@ -46,6 +49,8 @@ ColumnLayout { SectionHeader { id: generalHeader Layout.fillWidth: true + Layout.columnSpan: parent.columns + Layout.maximumWidth: parent.width text: qsTr("General") } @@ -53,6 +58,8 @@ ColumnLayout { GridLayout { id: generalGrid Layout.fillWidth: true + Layout.columnSpan: parent.columns + Layout.maximumWidth: parent.width columnSpacing: _margin rowSpacing: _margin columns: 2 @@ -67,22 +74,21 @@ ColumnLayout { Layout.fillWidth: true } - QGCLabel { text: qsTr("Relative Altitude!!!") } - QGCLabel { text: qsTr("Variant") - Layout.columnSpan: 2 + Layout.columnSpan: parent.columns visible: variantRepeater.len > 0 } + + ExclusiveGroup{id:variantGroup} + GridLayout{ - Layout.columnSpan: 2 - Layout.fillWidth: true - Layout.maximumWidth: parent.width + Layout.columnSpan: parent.columns + Layout.maximumWidth: parent.width columnSpacing: _margin rowSpacing: _margin - ExclusiveGroup{id:variantGroup} Repeater{ id: variantRepeater @@ -91,20 +97,20 @@ ColumnLayout { model: len delegate: QGCRadioButton { - checked: index === variant + checked: index === variantIndex text: variantRepeater.names[index] ? variantRepeater.names[index]: "" - property int variant: missionItem.variant.value + property int variantIndex: missionItem.variantIndex.value - onVariantChanged: { - if (variant === index){ + onVariantIndexChanged: { + if (variantIndex === index){ checked = true } } onCheckedChanged: { - if (checked && variant !== index){ - missionItem.variant.value = index + if (checked && variantIndex !== index){ + missionItem.variantIndex.value = index } } } @@ -116,12 +122,15 @@ ColumnLayout { SectionHeader { id: generatorHeader Layout.fillWidth: true + Layout.columnSpan: parent.columns text: qsTr("Generator") } GridLayout{ Layout.fillWidth: true columnSpacing: _margin + Layout.maximumWidth: parent.width + Layout.columnSpan: parent.columns rowSpacing: _margin columns: 2 visible: generatorHeader.checked @@ -130,7 +139,7 @@ ColumnLayout { property var names: missionItem.generatorNameList property int length: names.length - enabled: root.checked + enabled: _root.checked anchors.margins: ScreenTools.defaultFontPixelWidth currentIndex: missionItem.generatorIndex Layout.columnSpan: 2 @@ -147,6 +156,8 @@ ColumnLayout { ColumnLayout{ id:generatorEditorParent Layout.fillWidth: true + Layout.columnSpan: parent.columns + Layout.maximumWidth: parent.width visible: generatorHeader.checked } @@ -161,6 +172,7 @@ ColumnLayout { ColumnLayout{ Layout.fillWidth: true spacing: _margin + Layout.maximumWidth: parent.width BusyIndicator{ id: indicator @@ -196,7 +208,7 @@ ColumnLayout { _generatorEditor = component.createObject( generatorEditorParent, { - "generator": root._generator, + "generator": _root._generator, "availableWidth": generatorEditorParent.width, }) } -- 2.22.0