diff --git a/src/AutoPilotPlugins/APM/APMAirframeComponent.qml b/src/AutoPilotPlugins/APM/APMAirframeComponent.qml index c06d6a78f96cae2d66666b822114ed610020bbe6..ab7efbf3f904d4f50c548d6a269d5ddd58fc2dc3 100644 --- a/src/AutoPilotPlugins/APM/APMAirframeComponent.qml +++ b/src/AutoPilotPlugins/APM/APMAirframeComponent.qml @@ -62,10 +62,7 @@ SetupPage { } } - APMAirframeComponentController { - id: controller - factPanel: airframePage.viewPanel - } + APMAirframeComponentController { id: controller; } QGCLabel { id: helpText diff --git a/src/AutoPilotPlugins/APM/APMAirframeComponentSummary.qml b/src/AutoPilotPlugins/APM/APMAirframeComponentSummary.qml index 09b6fe94445062a30a31606ecc5109ac867a3c08..e53930ff29544b970e9972794c73b188d8767541 100644 --- a/src/AutoPilotPlugins/APM/APMAirframeComponentSummary.qml +++ b/src/AutoPilotPlugins/APM/APMAirframeComponentSummary.qml @@ -7,16 +7,10 @@ import QGroundControl.Controls 1.0 import QGroundControl.Controllers 1.0 import QGroundControl.Palette 1.0 -FactPanel { - id: panel - anchors.fill: parent - color: qgcPal.windowShadeDark - - QGCPalette { id: qgcPal; colorGroupEnabled: enabled } - APMAirframeComponentController { - id: controller - factPanel: panel - } +Item { + anchors.fill: parent + + APMAirframeComponentController {id: controller; } property Fact _frameClass: controller.getParameterFact(-1, "FRAME_CLASS") property Fact _frameType: controller.getParameterFact(-1, "FRAME_TYPE", false) diff --git a/src/AutoPilotPlugins/APM/APMCameraSubComponent.qml b/src/AutoPilotPlugins/APM/APMCameraSubComponent.qml index 868ab973fbc05fc237c4e3a763648d39202ab647..20916fa90a340e68a65f75715f9481c0142c80e0 100644 --- a/src/AutoPilotPlugins/APM/APMCameraSubComponent.qml +++ b/src/AutoPilotPlugins/APM/APMCameraSubComponent.qml @@ -165,17 +165,17 @@ SetupPage { // Whenever an MNT_RC_IN_* setting is changed make sure to turn on RC targeting Connections { target: _mountRCInPan - onValueChanged: _mountDefaultMode.value = _mountDefaultModeRCTargetting + onValueChanged: if(_mountDefaultMode) _mountDefaultMode.value = _mountDefaultModeRCTargetting } Connections { target: _mountRCInRoll - onValueChanged: _mountDefaultMode.value = _mountDefaultModeRCTargetting + onValueChanged: if(_mountDefaultMode) _mountDefaultMode.value = _mountDefaultModeRCTargetting } Connections { target: _mountRCInTilt - onValueChanged: _mountDefaultMode.value = _mountDefaultModeRCTargetting + onValueChanged: if(_mountDefaultMode) _mountDefaultMode.value = _mountDefaultModeRCTargetting } ListModel { diff --git a/src/AutoPilotPlugins/APM/APMLightsComponent.qml b/src/AutoPilotPlugins/APM/APMLightsComponent.qml index 9e0f4c31f82713341b8d646ddd5ba6c001710b51..d56e5fa91eb3c8f5af91a9b2d9d58d06cadbf78f 100644 --- a/src/AutoPilotPlugins/APM/APMLightsComponent.qml +++ b/src/AutoPilotPlugins/APM/APMLightsComponent.qml @@ -29,9 +29,7 @@ SetupPage { spacing: _margins width: availableWidth - FactPanelController { id: controller; factPanel: lightsPage.viewPanel } - - QGCPalette { id: palette; colorGroupEnabled: true } + FactPanelController { id: controller; } property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property bool _oldFW: _activeVehicle.versionCompare(3, 5, 2) < 0 @@ -176,7 +174,7 @@ SetupPage { anchors.top: settingsLabel.bottom width: lights1Combo.x + lights1Combo.width + lightsStepCombo.width + _margins height: lights2Combo.y + lights2Combo.height + lightsStepCombo.height + 2*_margins - color: palette.windowShade + color: qgcPal.windowShade QGCLabel { id: lights1Label diff --git a/src/AutoPilotPlugins/APM/APMPowerComponent.qml b/src/AutoPilotPlugins/APM/APMPowerComponent.qml index 025cfba7dff5b9155294037bf8c42beaebae60d9..3f9695bb650646adeb8a36fe5478ae2c6d53709b 100644 --- a/src/AutoPilotPlugins/APM/APMPowerComponent.qml +++ b/src/AutoPilotPlugins/APM/APMPowerComponent.qml @@ -252,13 +252,13 @@ SetupPage { QGCButton { text: qsTr("Calibrate") - enabled: _escCalibration.rawValue === 0 - onClicked: _escCalibration.rawValue = 3 + enabled: _escCalibration && _escCalibration.rawValue === 0 + onClicked: if(_escCalibration) _escCalibration.rawValue = 3 } Column { - enabled: _escCalibration.rawValue === 3 - QGCLabel { text: _escCalibration.rawValue === 3 ? qsTr("Now perform these steps:") : qsTr("Click Calibrate to start, then:") } + enabled: _escCalibration && _escCalibration.rawValue === 3 + QGCLabel { text: _escCalibration ? (_escCalibration.rawValue === 3 ? qsTr("Now perform these steps:") : qsTr("Click Calibrate to start, then:")) : "" } QGCLabel { text: qsTr("- Disconnect USB and battery so flight controller powers down") } QGCLabel { text: qsTr("- Connect the battery") } QGCLabel { text: qsTr("- The arming tone will be played (if the vehicle has a buzzer attached)") } diff --git a/src/AutoPilotPlugins/APM/APMPowerComponentSummary.qml b/src/AutoPilotPlugins/APM/APMPowerComponentSummary.qml index b3aa8750e21baf742fbc0182494c2a329831aab9..728bfd649bf564aa76494db2b423257335f03daf 100644 --- a/src/AutoPilotPlugins/APM/APMPowerComponentSummary.qml +++ b/src/AutoPilotPlugins/APM/APMPowerComponentSummary.qml @@ -17,7 +17,6 @@ import QGroundControl.Palette 1.0 Item { anchors.fill: parent - color: qgcPal.windowShadeDark FactPanelController { id: controller; } diff --git a/src/AutoPilotPlugins/APM/APMRadioComponentSummary.qml b/src/AutoPilotPlugins/APM/APMRadioComponentSummary.qml index 5eaf9f38161a52b592db1509389f90da6fa7fc30..cac9d073e962d33b3bf68cdc5ad7af4c44439b38 100644 --- a/src/AutoPilotPlugins/APM/APMRadioComponentSummary.qml +++ b/src/AutoPilotPlugins/APM/APMRadioComponentSummary.qml @@ -8,9 +8,7 @@ import QGroundControl.Palette 1.0 Item { anchors.fill: parent - color: qgcPal.windowShadeDark - QGCPalette { id: qgcPal; colorGroupEnabled: enabled } FactPanelController { id: controller; } property Fact mapRollFact: controller.getParameterFact(-1, "RCMAP_ROLL") diff --git a/src/AutoPilotPlugins/APM/APMSafetyComponentSummary.qml b/src/AutoPilotPlugins/APM/APMSafetyComponentSummary.qml index bdeeedf49b10490cc7cff4447cc0a519474d1b84..c7e8b55ed6e09d1c4d91742c8bbedb9244cc6fd6 100644 --- a/src/AutoPilotPlugins/APM/APMSafetyComponentSummary.qml +++ b/src/AutoPilotPlugins/APM/APMSafetyComponentSummary.qml @@ -32,14 +32,14 @@ Item { VehicleSummaryRow { labelText: qsTr("Arming Checks:") - valueText: fact.value & 1 ? qsTr("Enabled") : qsTr("Some disabled") + valueText: fact ? (fact.value & 1 ? qsTr("Enabled") : qsTr("Some disabled")) : "" property Fact fact: controller.getParameterFact(-1, "ARMING_CHECK") } VehicleSummaryRow { labelText: qsTr("Throttle failsafe:") - valueText: fact.enumStringValue + valueText: fact ? fact.enumStringValue : "" visible: controller.vehicle.multiRotor property Fact fact: controller.getParameterFact(-1, "FS_THR_ENABLE", false /* reportMissing */) @@ -47,7 +47,7 @@ Item { VehicleSummaryRow { labelText: qsTr("Throttle failsafe:") - valueText: fact.enumStringValue + valueText: fact ? fact.enumStringValue : "" visible: controller.vehicle.fixedWing property Fact fact: controller.getParameterFact(-1, "THR_FAILSAFE", false /* reportMissing */) @@ -55,7 +55,7 @@ Item { VehicleSummaryRow { labelText: qsTr("Throttle failsafe:") - valueText: fact.enumStringValue + valueText: fact ? fact.enumStringValue : "" visible: controller.vehicle.rover property Fact fact: controller.getParameterFact(-1, "FS_THR_ENABLE", false /* reportMissing */) @@ -63,7 +63,7 @@ Item { VehicleSummaryRow { labelText: qsTr("Failsafe Action:") - valueText: fact.enumStringValue + valueText: fact ? fact.enumStringValue : "" visible: controller.vehicle.rover property Fact fact: controller.getParameterFact(-1, "FS_ACTION", false /* reportMissing */) @@ -71,7 +71,7 @@ Item { VehicleSummaryRow { labelText: qsTr("Failsafe Crash Check:") - valueText: fact.enumStringValue + valueText: fact ? fact.enumStringValue : "" visible: controller.vehicle.rover property Fact fact: controller.getParameterFact(-1, "FS_CRASH_CHECK", false /* reportMissing */) @@ -103,11 +103,22 @@ Item { VehicleSummaryRow { labelText: qsTr("GeoFence:") - valueText: _copterFenceEnable.value == 0 || _copterFenceType == 0 ? - qsTr("Disabled") : - (_copterFenceType.value == 1 ? - qsTr("Altitude") : - (_copterFenceType.value == 2 ? qsTr("Circle") : qsTr("Altitude,Circle"))) + valueText: { + if(_copterFenceEnable && _copterFenceType) { + if(_copterFenceEnable.value == 0 || _copterFenceType == 0) { + return qsTr("Disabled") + } else { + if(_copterFenceType.value == 1) { + return qsTr("Altitude") + } + if(_copterFenceType.value == 2) { + return qsTr("Circle") + } + return qsTr("Altitude,Circle") + } + } + return "" + } visible: controller.vehicle.multiRotor } @@ -121,16 +132,16 @@ Item { VehicleSummaryRow { labelText: qsTr("RTL min alt:") - valueText: fact.value == 0 ? qsTr("current") : fact.valueString + " " + fact.units + valueText: fact ? (fact.value == 0 ? qsTr("current") : fact.valueString + " " + fact.units) : "" visible: controller.vehicle.multiRotor property Fact fact: controller.getParameterFact(-1, "RTL_ALT", false /* reportMissing */) } VehicleSummaryRow { - labelText: qsTr("RTL min alt:") - valueText: fact.value < 0 ? qsTr("current") : fact.valueString + " " + fact.units - visible: controller.vehicle.fixedWing + labelText: qsTr("RTL min alt:") + valueText: fact ? (fact.value < 0 ? qsTr("current") : fact.valueString + " " + fact.units) : "" + visible: controller.vehicle.fixedWing property Fact fact: controller.getParameterFact(-1, "ALT_HOLD_RTL", false /* reportMissing */) } diff --git a/src/AutoPilotPlugins/APM/APMSensorsComponentSummary.qml b/src/AutoPilotPlugins/APM/APMSensorsComponentSummary.qml index 31bdf68929bb00890c865e1bf7d1112575268848..8d4ff91a503bf4b6f7bcbf4dfd586e5ed4d407a0 100644 --- a/src/AutoPilotPlugins/APM/APMSensorsComponentSummary.qml +++ b/src/AutoPilotPlugins/APM/APMSensorsComponentSummary.qml @@ -15,7 +15,6 @@ import QGroundControl.ArduPilot 1.0 Item { anchors.fill: parent - color: qgcPal.windowShadeDark APMSensorsComponentController { id: controller; } diff --git a/src/AutoPilotPlugins/APM/APMTuningComponent.h b/src/AutoPilotPlugins/APM/APMTuningComponent.h index aa4d98c5ae71f292cf0f5be2c9e2152fe9ccb46a..1be4426e5b9edc69e7e762112adf02f3a76189d2 100644 --- a/src/AutoPilotPlugins/APM/APMTuningComponent.h +++ b/src/AutoPilotPlugins/APM/APMTuningComponent.h @@ -18,7 +18,7 @@ class APMTuningComponent : public VehicleComponent Q_OBJECT public: - APMTuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); + APMTuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = nullptr); // Virtuals from VehicleComponent QStringList setupCompleteChangedTriggerList(void) const final; diff --git a/src/AutoPilotPlugins/APM/APMTuningComponentCopter.qml b/src/AutoPilotPlugins/APM/APMTuningComponentCopter.qml index 8f9f089f129a04b80345bb6faaf3ff22ffa9268b..433d7740900849b9e7d9228da157e66217a3881c 100644 --- a/src/AutoPilotPlugins/APM/APMTuningComponentCopter.qml +++ b/src/AutoPilotPlugins/APM/APMTuningComponentCopter.qml @@ -28,7 +28,7 @@ SetupPage { Column { width: availableWidth - QGCPalette { id: palette; colorGroupEnabled: true } + FactPanelController { id: controller; } property bool _atcInputTCAvailable: controller.parameterExists(-1, "ATC_INPUT_TC") property Fact _atcInputTC: controller.getParameterFact(-1, "ATC_INPUT_TC", false) @@ -133,7 +133,7 @@ SetupPage { anchors.left: parent.left anchors.right: parent.right height: basicTuningColumn.y + basicTuningColumn.height + _margins - color: palette.windowShade + color: qgcPal.windowShade Column { id: basicTuningColumn @@ -284,7 +284,7 @@ SetupPage { QGCLabel { text: qsTr("Warning: This setting should be higher than 'Spin While Armed'") - color: palette.warningText + color: qgcPal.warningText visible: _motSpinMin.rawValue < _motSpinArm.rawValue } @@ -315,7 +315,7 @@ SetupPage { Rectangle { height: autoTuneLabel.height + autoTuneRect.height width: autoTuneRect.width - color: palette.window + color: qgcPal.window QGCLabel { id: autoTuneLabel @@ -328,7 +328,7 @@ SetupPage { width: autoTuneColumn.x + autoTuneColumn.width + _margins height: autoTuneColumn.y + autoTuneColumn.height + _margins anchors.top: autoTuneLabel.bottom - color: palette.windowShade + color: qgcPal.windowShade Column { id: autoTuneColumn @@ -375,7 +375,7 @@ SetupPage { Rectangle { height: inFlightTuneLabel.height + channel6TuningOption.height width: channel6TuningOption.width - color: palette.window + color: qgcPal.window QGCLabel { id: inFlightTuneLabel diff --git a/src/FactSystem/FactControls/FactBitmask.qml b/src/FactSystem/FactControls/FactBitmask.qml index 517ce6a4bf5a4b2361454e6117c3e0f95fbc02ac..11f88416a168c57f61a2af32163b6095e5bf5e75 100644 --- a/src/FactSystem/FactControls/FactBitmask.qml +++ b/src/FactSystem/FactControls/FactBitmask.qml @@ -25,7 +25,7 @@ Flow { Repeater { id: repeater - model: fact.bitmaskStrings + model: fact ? fact.bitmaskStrings : [] QGCCheckBox { id: checkbox diff --git a/src/QmlControls/RCChannelMonitor.qml b/src/QmlControls/RCChannelMonitor.qml index b83e8cb27562c5e37d5b0bd86565d5004c9f47e3..4d23a550057afe087fd98c5e6d610a280b6574c5 100644 --- a/src/QmlControls/RCChannelMonitor.qml +++ b/src/QmlControls/RCChannelMonitor.qml @@ -59,7 +59,7 @@ Item { // Center point Rectangle { anchors.horizontalCenter: parent.horizontalCenter - width: ScreenTools.ScreenTools.defaultFontPixelWidth / 2 + width: ScreenTools.defaultFontPixelWidth / 2 height: parent.height color: qgcPal.window }