Commit 6139f8b1 authored by Don Gagne's avatar Don Gagne Committed by DoinLakeFlyer

Merge pull request #8573 from DonLakeFlyer/RadioButtonProblems

Fix Radio button problems
parent 8db83439
...@@ -58,6 +58,7 @@ SetupPage { ...@@ -58,6 +58,7 @@ SetupPage {
property Fact _armingCheck: controller.getParameterFact(-1, "ARMING_CHECK") property Fact _armingCheck: controller.getParameterFact(-1, "ARMING_CHECK")
property real _margins: ScreenTools.defaultFontPixelHeight property real _margins: ScreenTools.defaultFontPixelHeight
property real _innerMargin: _margins / 2
property bool _showIcon: !ScreenTools.isTinyScreen property bool _showIcon: !ScreenTools.isTinyScreen
property bool _roverFirmware: controller.parameterExists(-1, "MODE1") // This catches all usage of ArduRover firmware vehicle types: Rover, Boat... property bool _roverFirmware: controller.parameterExists(-1, "MODE1") // This catches all usage of ArduRover firmware vehicle types: Rover, Boat...
...@@ -551,8 +552,8 @@ SetupPage { ...@@ -551,8 +552,8 @@ SetupPage {
Rectangle { Rectangle {
id: rtlSettings id: rtlSettings
width: rltAltFinalField.x + rltAltFinalField.width + _margins width: landSpeedField.x + landSpeedField.width + _margins
height: rltAltFinalField.y + rltAltFinalField.height + _margins height: landSpeedField.y + landSpeedField.height + _margins
color: ggcPal.windowShade color: ggcPal.windowShade
Image { Image {
...@@ -578,7 +579,7 @@ SetupPage { ...@@ -578,7 +579,7 @@ SetupPage {
QGCRadioButton { QGCRadioButton {
id: returnAtCurrentRadio id: returnAtCurrentRadio
anchors.margins: _margins anchors.margins: _innerMargin
anchors.left: _showIcon ? icon.right : parent.left anchors.left: _showIcon ? icon.right : parent.left
anchors.top: parent.top anchors.top: parent.top
text: qsTr("Return at current altitude") text: qsTr("Return at current altitude")
...@@ -589,9 +590,9 @@ SetupPage { ...@@ -589,9 +590,9 @@ SetupPage {
QGCRadioButton { QGCRadioButton {
id: returnAltRadio id: returnAltRadio
anchors.topMargin: _margins anchors.topMargin: _innerMargin
anchors.left: returnAtCurrentRadio.left
anchors.top: returnAtCurrentRadio.bottom anchors.top: returnAtCurrentRadio.bottom
anchors.left: returnAtCurrentRadio.left
text: qsTr("Return at specified altitude:") text: qsTr("Return at specified altitude:")
checked: _rtlAltFact.value != 0 checked: _rtlAltFact.value != 0
...@@ -620,7 +621,7 @@ SetupPage { ...@@ -620,7 +621,7 @@ SetupPage {
FactTextField { FactTextField {
id: landDelayField id: landDelayField
anchors.topMargin: _margins * 1.5 anchors.topMargin: _innerMargin
anchors.left: rltAltField.left anchors.left: rltAltField.left
anchors.top: rltAltField.bottom anchors.top: rltAltField.bottom
fact: _rtlLoitTimeFact fact: _rtlLoitTimeFact
...@@ -628,42 +629,33 @@ SetupPage { ...@@ -628,42 +629,33 @@ SetupPage {
enabled: homeLoiterCheckbox.checked === true enabled: homeLoiterCheckbox.checked === true
} }
QGCRadioButton { QGCLabel {
id: landRadio
anchors.left: returnAtCurrentRadio.left anchors.left: returnAtCurrentRadio.left
anchors.baseline: landSpeedField.baseline anchors.baseline: rltAltFinalField.baseline
text: qsTr("Land with descent speed:") text: qsTr("Final land stage altitude:")
checked: _rtlAltFinalFact.value == 0
onClicked: _rtlAltFinalFact.value = 0
} }
FactTextField { FactTextField {
id: landSpeedField id: rltAltFinalField
anchors.topMargin: _margins * 1.5 anchors.topMargin: _innerMargin
anchors.top: landDelayField.bottom
anchors.left: rltAltField.left anchors.left: rltAltField.left
fact: _landSpeedFact anchors.top: landDelayField.bottom
fact: _rtlAltFinalFact
showUnits: true showUnits: true
enabled: landRadio.checked
} }
QGCRadioButton { QGCLabel {
id: finalLoiterRadio
anchors.left: returnAtCurrentRadio.left anchors.left: returnAtCurrentRadio.left
anchors.baseline: rltAltFinalField.baseline anchors.baseline: landSpeedField.baseline
text: qsTr("Final loiter altitude:") text: qsTr("Final land stage descent speed:")
onClicked: _rtlAltFinalFact.value = _rtlAltFact.value
} }
FactTextField { FactTextField {
id: rltAltFinalField id: landSpeedField
anchors.topMargin: _margins / 2 anchors.topMargin: _innerMargin
anchors.left: rltAltField.left anchors.left: rltAltField.left
anchors.top: landSpeedField.bottom anchors.top: rltAltFinalField.bottom
fact: _rtlAltFinalFact fact: _landSpeedFact
enabled: finalLoiterRadio.checked
showUnits: true showUnits: true
} }
} // Rectangle - RTL Settings } // Rectangle - RTL Settings
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
****************************************************************************/ ****************************************************************************/
import QtQuick 2.3 import QtQuick 2.3
import QtQuick.Controls 1.2 import QtQuick.Controls 2.4
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.11 import QtQuick.Layouts 1.11
...@@ -90,7 +90,7 @@ SetupPage { ...@@ -90,7 +90,7 @@ SetupPage {
QGCViewDialog { QGCViewDialog {
function accept() { function accept() {
controller.spektrumBindMode(radioGroup.current.bindMode) controller.spektrumBindMode(radioGroup.checkedButton.bindMode)
hideDialog() hideDialog()
} }
...@@ -98,6 +98,8 @@ SetupPage { ...@@ -98,6 +98,8 @@ SetupPage {
hideDialog() hideDialog()
} }
ButtonGroup { id: radioGroup }
Column { Column {
anchors.fill: parent anchors.fill: parent
spacing: 5 spacing: 5
...@@ -109,18 +111,21 @@ SetupPage { ...@@ -109,18 +111,21 @@ SetupPage {
} }
QGCRadioButton { QGCRadioButton {
text: qsTr("DSM2 Mode") text: qsTr("DSM2 Mode")
ButtonGroup.group: radioGroup
property int bindMode: RadioComponentController.DSM2 property int bindMode: RadioComponentController.DSM2
} }
QGCRadioButton { QGCRadioButton {
text: qsTr("DSMX (7 channels or less)") text: qsTr("DSMX (7 channels or less)")
ButtonGroup.group: radioGroup
property int bindMode: RadioComponentController.DSMX7 property int bindMode: RadioComponentController.DSMX7
} }
QGCRadioButton { QGCRadioButton {
checked: true checked: true
text: qsTr("DSMX (8 channels or more)") text: qsTr("DSMX (8 channels or more)")
ButtonGroup.group: radioGroup
property int bindMode: RadioComponentController.DSMX8 property int bindMode: RadioComponentController.DSMX8
} }
} }
......
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