Commit 182b76af authored by Gus Grubba's avatar Gus Grubba

Convert QGCRadioButton to QtQuick.Controls 2.4 (eliminate ExclusiveGroup)

parent 584cf293
......@@ -35,10 +35,6 @@ SetupPage {
id: controller
}
ExclusiveGroup {
id: airframeTypeExclusive
}
Component {
id: oldFramePageComponent
......@@ -62,12 +58,9 @@ SetupPage {
Repeater {
model: controller.airframeTypesModel
QGCRadioButton {
text: object.name
checked: controller.currentAirframeType == object
exclusiveGroup: airframeTypeExclusive
onCheckedChanged: {
if (checked) {
controller.currentAirframeType = object
......
......@@ -62,10 +62,6 @@ SetupPage {
property string _restartRequired: qsTr("Requires vehicle reboot")
ExclusiveGroup { id: fenceActionRadioGroup }
ExclusiveGroup { id: landLoiterRadioGroup }
ExclusiveGroup { id: returnAltRadioGroup }
Component {
id: batteryFailsafeComponent
......@@ -478,7 +474,6 @@ SetupPage {
anchors.left: parent.left
anchors.top: altitudeGeo.bottom
text: qsTr("Report only")
exclusiveGroup: fenceActionRadioGroup
checked: _fenceAction.value == 0
onClicked: _fenceAction.value = 0
......@@ -490,7 +485,6 @@ SetupPage {
anchors.left: circleGeo.left
anchors.top: geoReportRadio.bottom
text: qsTr("RTL or Land")
exclusiveGroup: fenceActionRadioGroup
checked: _fenceAction.value == 1
onClicked: _fenceAction.value = 1
......@@ -587,7 +581,6 @@ SetupPage {
anchors.top: parent.top
text: qsTr("Return at current altitude")
checked: _rtlAltFact.value == 0
exclusiveGroup: returnAltRadioGroup
onClicked: _rtlAltFact.value = 0
}
......@@ -598,7 +591,6 @@ SetupPage {
anchors.left: returnAtCurrentRadio.left
anchors.top: returnAtCurrentRadio.bottom
text: qsTr("Return at specified altitude:")
exclusiveGroup: returnAltRadioGroup
checked: _rtlAltFact.value != 0
onClicked: _rtlAltFact.value = 1500
......@@ -640,7 +632,6 @@ SetupPage {
anchors.baseline: landSpeedField.baseline
text: qsTr("Land with descent speed:")
checked: _rtlAltFinalFact.value == 0
exclusiveGroup: landLoiterRadioGroup
onClicked: _rtlAltFinalFact.value = 0
}
......@@ -660,7 +651,6 @@ SetupPage {
anchors.left: returnAtCurrentRadio.left
anchors.baseline: rltAltFinalField.baseline
text: qsTr("Final loiter altitude:")
exclusiveGroup: landLoiterRadioGroup
onClicked: _rtlAltFinalFact.value = _rtlAltFact.value
}
......@@ -707,7 +697,6 @@ SetupPage {
anchors.top: parent.top
text: qsTr("Return at current altitude")
checked: _rtlAltFact.value < 0
exclusiveGroup: returnAltRadioGroup
onClicked: _rtlAltFact.value = -1
}
......@@ -718,7 +707,6 @@ SetupPage {
anchors.left: returnAtCurrentRadio.left
anchors.top: returnAtCurrentRadio.bottom
text: qsTr("Return at specified altitude:")
exclusiveGroup: returnAltRadioGroup
checked: _rtlAltFact.value >= 0
onClicked: _rtlAltFact.value = 10000
......
......@@ -108,27 +108,19 @@ SetupPage {
text: qsTr("Click Ok to place your Spektrum receiver in the bind mode. Select the specific receiver type below:")
}
ExclusiveGroup { id: radioGroup }
QGCRadioButton {
exclusiveGroup: radioGroup
text: qsTr("DSM2 Mode")
text: qsTr("DSM2 Mode")
property int bindMode: RadioComponentController.DSM2
}
QGCRadioButton {
exclusiveGroup: radioGroup
text: qsTr("DSMX (7 channels or less)")
text: qsTr("DSMX (7 channels or less)")
property int bindMode: RadioComponentController.DSMX7
}
QGCRadioButton {
exclusiveGroup: radioGroup
checked: true
text: qsTr("DSMX (8 channels or more)")
checked: true
text: qsTr("DSMX (8 channels or more)")
property int bindMode: RadioComponentController.DSMX8
}
}
......@@ -440,22 +432,16 @@ SetupPage {
Row {
spacing: ScreenTools.defaultFontPixelWidth
ExclusiveGroup { id: modeGroup }
QGCRadioButton {
exclusiveGroup: modeGroup
text: qsTr("Mode 1")
checked: controller.transmitterMode == 1
onClicked: controller.transmitterMode = 1
text: qsTr("Mode 1")
checked: controller.transmitterMode == 1
onClicked: controller.transmitterMode = 1
}
QGCRadioButton {
exclusiveGroup: modeGroup
text: qsTr("Mode 2")
checked: controller.transmitterMode == 2
onClicked: controller.transmitterMode = 2
text: qsTr("Mode 2")
checked: controller.transmitterMode == 2
onClicked: controller.transmitterMode = 2
}
}
......
......@@ -261,10 +261,8 @@ SetupPage {
Item { height: 1; width: _margins; }
Column {
spacing: _margins * 0.5
ExclusiveGroup { id: polarityGroup }
QGCRadioButton {
checked: _camTriggerPol && _camTriggerPol.value === 0
exclusiveGroup: polarityGroup
text: "Low (0V)"
onClicked: {
if(_camTriggerPol) {
......@@ -274,7 +272,6 @@ SetupPage {
}
QGCRadioButton {
checked: _camTriggerPol && _camTriggerPol.value > 0
exclusiveGroup: polarityGroup
text: "High (3.3V)"
onClicked: {
if(_camTriggerPol) {
......
......@@ -54,8 +54,6 @@ SetupPage {
property bool _hitlAvailable: controller.parameterExists(-1, hitlParam)
property Fact _hitlEnabled: controller.getParameterFact(-1, hitlParam, false)
ExclusiveGroup { id: homeLoiterGroup }
Rectangle {
x: lowBattGrid.x + outerGrid.x - _margins
y: lowBattGrid.y + outerGrid.y - _margins
......@@ -391,7 +389,6 @@ SetupPage {
QGCRadioButton {
id: homeLandRadio
checked: _rtlLandDelay ? _rtlLandDelay.value === 0 : false
exclusiveGroup: homeLoiterGroup
text: qsTr("Land immediately")
onClicked: _rtlLandDelay.value = 0
}
......@@ -402,7 +399,6 @@ SetupPage {
QGCRadioButton {
id: homeLoiterNoLandRadio
checked: _rtlLandDelay ? _rtlLandDelay.value < 0 : false
exclusiveGroup: homeLoiterGroup
text: qsTr("Loiter and do not land")
onClicked: _rtlLandDelay.value = -1
}
......@@ -413,7 +409,6 @@ SetupPage {
QGCRadioButton {
id: homeLoiterLandRadio
checked: _rtlLandDelay ? _rtlLandDelay.value > 0 : false
exclusiveGroup: homeLoiterGroup
text: qsTr("Loiter and land after specified time")
onClicked: _rtlLandDelay.value = 60
}
......
......@@ -496,18 +496,14 @@ Item {
z: _mapAndVideo.z + 4
visible: QGroundControl.multiVehicleManager.vehicles.count > 1 && QGroundControl.corePlugin.options.enableMultiVehicleList
ExclusiveGroup { id: multiVehicleSelectorGroup }
QGCRadioButton {
id: singleVehicleView
exclusiveGroup: multiVehicleSelectorGroup
text: qsTr("Single")
checked: true
textColor: mapPal.text
}
QGCRadioButton {
exclusiveGroup: multiVehicleSelectorGroup
text: qsTr("Multi-Vehicle")
textColor: mapPal.text
}
......
......@@ -344,9 +344,6 @@ Item {
insertComplexMissionItemFromKMLOrSHP(complexItemName, polygonSelectPatternFile, -1)
hideDialog()
}
ExclusiveGroup {
id: radioGroup
}
Column {
anchors.left: parent.left
anchors.right: parent.right
......@@ -361,11 +358,9 @@ Item {
id: surveyRadio
text: qsTr("Survey")
checked: true
exclusiveGroup: radioGroup
}
QGCRadioButton {
text: qsTr("Structure Scan")
exclusiveGroup: radioGroup
}
}
}
......@@ -732,43 +727,27 @@ Item {
visible: !QGroundControl.corePlugin.options.enablePlanViewSelector
anchors.verticalCenter: parent.verticalCenter
}
ExclusiveGroup {
id: planElementSelectorGroup
onCurrentChanged: {
switch (current) {
case planElementMission:
_editingLayer = _layerMission
break
case planElementGeoFence:
_editingLayer = _layerGeoFence
break
case planElementRallyPoints:
_editingLayer = _layerRallyPoints
break
}
}
}
QGCRadioButton {
id: planElementMission
exclusiveGroup: planElementSelectorGroup
text: qsTr("Mission")
checked: true
visible: QGroundControl.corePlugin.options.enablePlanViewSelector
anchors.verticalCenter: parent.verticalCenter
onClicked: _editingLayer = _layerMission
}
QGCRadioButton {
id: planElementGeoFence
exclusiveGroup: planElementSelectorGroup
text: qsTr("Fence")
visible: QGroundControl.corePlugin.options.enablePlanViewSelector
anchors.verticalCenter: parent.verticalCenter
onClicked: _editingLayer = _layerGeoFence
}
QGCRadioButton {
id: planElementRallyPoints
exclusiveGroup: planElementSelectorGroup
text: qsTr("Rally")
visible: QGroundControl.corePlugin.options.enablePlanViewSelector
anchors.verticalCenter: parent.verticalCenter
onClicked: _editingLayer = _layerRallyPoints
}
}
}
......
......@@ -150,10 +150,6 @@ RowLayout {
resetGraphs()
}
ExclusiveGroup {
id: tuneTypeRadios
}
ValueAxis {
id: valueXAxis
min: 0
......@@ -246,8 +242,6 @@ RowLayout {
QGCRadioButton {
text: modelData
checked: _currentTuneType === modelData
exclusiveGroup: tuneTypeRadios
onClicked: _currentTuneType = modelData
}
}
......
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick 2.11
import QtQuick.Controls 2.4
import QtQuick.Controls.Styles 1.4
import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
RadioButton {
id: control
property color textColor: _qgcPal.text
property bool textBold: false
property real textFontPointSize: ScreenTools.defaultFontPointSize
property var _qgcPal: QGCPalette { colorGroupEnabled: enabled }
property bool _noText: text === ""
activeFocusOnPress: true
style: RadioButtonStyle {
spacing: _noText ? 0 : ScreenTools.defaultFontPixelWidth * 0.25
label: Item {
implicitWidth: _noText ? 0 : text.implicitWidth + ScreenTools.defaultFontPixelWidth * 0.25
implicitHeight: _noText ? 0 : Math.max(text.implicitHeight, ScreenTools.radioButtonIndicatorSize)
baselineOffset: text.y + text.baselineOffset
Text {
id: text
text: control.text
font.pointSize: textFontPointSize
font.bold: control.textBold
color: control.textColor
anchors.centerIn: parent
}
property var _qgcPal: QGCPalette { colorGroupEnabled: enabled }
property bool _noText: text === ""
indicator: Rectangle {
implicitWidth: ScreenTools.radioButtonIndicatorSize
implicitHeight: width
color: "white"
border.color: "black"
radius: height / 2
opacity: control.enabled ? 1 : 0.5
x: control.leftPadding
y: parent.height / 2 - height / 2
Rectangle {
anchors.centerIn: parent
width: Math.round(parent.width * 0.5)
height: width
antialiasing: true
radius: height * 0.5
color: "black"
visible: control.checked
}
}
indicator: Rectangle {
width: ScreenTools.radioButtonIndicatorSize
height: width
color: "white"
border.color: "black"
radius: height / 2
opacity: control.enabled ? 1 : 0.5
Rectangle {
anchors.centerIn: parent
width: Math.round(parent.width * 0.5)
height: width
antialiasing: true
radius: height / 2
color: "black"
visible: control.checked
}
}
contentItem: Text {
text: control.text
font.pointSize: textFontPointSize
font.bold: control.textBold
color: control.textColor
opacity: enabled ? 1.0 : 0.3
verticalAlignment: Text.AlignVCenter
leftPadding: control.indicator.width + (_noText ? 0 : ScreenTools.defaultFontPixelWidth * 0.25)
}
}
......@@ -1195,9 +1195,6 @@ Item {
height: width
anchors.horizontalCenter: parent.horizontalCenter
}
ButtonGroup {
buttons: mapSetButtons.children
}
Column {
id: mapSetButtons
spacing: ScreenTools.defaultFontPixelHeight
......
......@@ -194,10 +194,6 @@ SetupPage {
onCancelDialog: reject()
}
ExclusiveGroup {
id: firmwareGroup
}
ListModel {
id: firmwareTypeList
......@@ -288,7 +284,6 @@ SetupPage {
QGCRadioButton {
id: px4FlightStackRadio1
exclusiveGroup: _defaultFirmwareIsPX4 ? firmwareGroup : null
text: qsTr("PX4 Flight Stack ")
textBold: _defaultFirmwareIsPX4
checked: _defaultFirmwareIsPX4
......@@ -302,7 +297,6 @@ SetupPage {
QGCRadioButton {
id: apmFlightStack
exclusiveGroup: firmwareGroup
text: qsTr("ArduPilot Flight Stack")
textBold: !_defaultFirmwareIsPX4
checked: !_defaultFirmwareIsPX4
......@@ -316,7 +310,6 @@ SetupPage {
QGCRadioButton {
id: px4FlightStackRadio2
exclusiveGroup: _defaultFirmwareIsPX4 ? null : firmwareGroup
text: qsTr("PX4 Flight Stack ")
visible: !_defaultFirmwareIsPX4 && !_singleFirmwareMode && !px4Flow
......
......@@ -410,10 +410,7 @@ SetupPage {
spacing: ScreenTools.defaultFontPixelHeight / 3
visible: activeVehicle.supportsThrottleModeCenterZero
ExclusiveGroup { id: throttleModeExclusiveGroup }
QGCRadioButton {
exclusiveGroup: throttleModeExclusiveGroup
text: qsTr("Center stick is zero throttle")
checked: _activeJoystick ? _activeJoystick.throttleMode == 0 : false
......@@ -436,7 +433,6 @@ SetupPage {
}
QGCRadioButton {
exclusiveGroup: throttleModeExclusiveGroup
text: qsTr("Full down stick is zero throttle")
checked: _activeJoystick ? _activeJoystick.throttleMode == 1 : false
......@@ -726,14 +722,11 @@ SetupPage {
Row {
spacing: ScreenTools.defaultFontPixelWidth
ExclusiveGroup { id: modeGroup }
QGCLabel {
text: "TX Mode:"
}
QGCRadioButton {
exclusiveGroup: modeGroup
text: "1"
checked: controller.transmitterMode == 1
enabled: !controller.calibrating
......@@ -742,7 +735,6 @@ SetupPage {
}
QGCRadioButton {
exclusiveGroup: modeGroup
text: "2"
checked: controller.transmitterMode == 2
enabled: !controller.calibrating
......@@ -751,7 +743,6 @@ SetupPage {
}
QGCRadioButton {
exclusiveGroup: modeGroup
text: "3"
checked: controller.transmitterMode == 3
enabled: !controller.calibrating
......@@ -760,7 +751,6 @@ SetupPage {
}
QGCRadioButton {
exclusiveGroup: modeGroup
text: "4"
checked: controller.transmitterMode == 4
enabled: !controller.calibrating
......
......@@ -639,16 +639,11 @@ Rectangle {
property bool useFixedPosition: rtkSettings.useFixedBasePosition.rawValue
property real firstColWidth: ScreenTools.defaultFontPixelWidth * 3
ExclusiveGroup {
id: useFixedBasePositionRadioGroup
}
QGCRadioButton {
text: qsTr("Perform Survey-In")
visible: rtkGrid.rtkSettings.useFixedBasePosition.visible
checked: rtkGrid.rtkSettings.useFixedBasePosition.value == false
onClicked: rtkGrid.rtkSettings.useFixedBasePosition.value = false
exclusiveGroup: useFixedBasePositionRadioGroup
Layout.columnSpan: 3
}
......@@ -683,7 +678,6 @@ Rectangle {
visible: rtkGrid.rtkSettings.useFixedBasePosition.visible
checked: rtkGrid.rtkSettings.useFixedBasePosition.value == true
onClicked: rtkGrid.rtkSettings.useFixedBasePosition.value = true
exclusiveGroup: useFixedBasePositionRadioGroup
Layout.columnSpan: 3
}
......
......@@ -58,24 +58,20 @@ Column {
width: parent.width
}
ColumnLayout {
ExclusiveGroup { id: autoPilotGroup }
QGCRadioButton {
id: px4Firmware
text: qsTr("PX4 Firmware")
checked: false
exclusiveGroup: autoPilotGroup
}
QGCRadioButton {
id: apmFirmware
text: qsTr("APM Firmware")
checked: false
exclusiveGroup: autoPilotGroup
}
QGCRadioButton {
id: genericFirmware
text: qsTr("Generic Firmware")
checked: false
exclusiveGroup: autoPilotGroup
}
}
Item {
......@@ -88,18 +84,15 @@ Column {
}
ColumnLayout {
visible: apmFirmware.checked
ExclusiveGroup { id: apmVehicleGroup }
QGCRadioButton {
id: copterVehicle
text: qsTr("ArduCopter")
checked: false
exclusiveGroup: apmVehicleGroup
}
QGCRadioButton {
id: planeVehicle
text: qsTr("ArduPlane")
checked: false
exclusiveGroup: apmVehicleGroup
}
}
}
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