diff --git a/src/AutoPilotPlugins/PX4/AirframeComponent.qml b/src/AutoPilotPlugins/PX4/AirframeComponent.qml
index 53d12db5d1d6cc17ab1a72fc385fc57186cfd629..b2c3a5a6f04bb42cb09d12fce0d7cb4429254ba2 100644
--- a/src/AutoPilotPlugins/PX4/AirframeComponent.qml
+++ b/src/AutoPilotPlugins/PX4/AirframeComponent.qml
@@ -94,6 +94,8 @@ QGCView {
id: panel
anchors.fill: parent
+ readonly property real spacerHeight: ScreenTools.defaultFontPixelHeight
+
QGCLabel {
id: header
width: parent.width
@@ -104,30 +106,36 @@ QGCView {
Item {
id: headingSpacer
anchors.top: header.bottom
- height: 20
+ height: parent.spacerHeight
width: 20
}
- QGCLabel {
+ Item {
+ id: helpApplyRow
anchors.top: headingSpacer.bottom
- width: parent.width - applyButton.width - 5
- text: "Please select your airframe type. Click 'Apply and Restart' to reboot the autopilot. Please re-connect then manually."
- wrapMode: Text.WordWrap
- }
+ width: parent.width
+ height: Math.max(helpText.contentHeight, applyButton.height)
- QGCButton {
- id: applyButton
- anchors.top: headingSpacer.bottom
- anchors.right: parent.right
- text: "Apply and Restart"
+ QGCLabel {
+ id: helpText
+ width: parent.width - applyButton.width - 5
+ text: "Please select your airframe type. Click 'Apply and Restart' to reboot the autopilot. Please re-connect then manually."
+ wrapMode: Text.WordWrap
+ }
- onClicked: showDialog(applyRestartDialogComponent, "Apply and Restart", 50, StandardButton.Apply | StandardButton.Cancel)
+ QGCButton {
+ id: applyButton
+ anchors.right: parent.right
+ text: "Apply and Restart"
+
+ onClicked: showDialog(applyRestartDialogComponent, "Apply and Restart", 50, StandardButton.Apply | StandardButton.Cancel)
+ }
}
Item {
id: lastSpacer
- anchors.top: applyButton.bottom
- height: 20
+ anchors.top: helpApplyRow.bottom
+ height: parent.spacerHeight
width: 10
}
@@ -140,7 +148,7 @@ QGCView {
Flow {
width: scroll.width
- spacing: 10
+ spacing: ScreenTools.defaultFontPixelWidth
ExclusiveGroup {
id: airframeTypeExclusive
@@ -152,16 +160,16 @@ QGCView {
// Outer summary item rectangle
Rectangle {
id: airframeBackground
- readonly property real titleHeight: 30
- readonly property real innerMargin: 10
-
- width: 250
- height: 200
+ width: ScreenTools.defaultFontPixelWidth * 30
+ height: width * .75
color: (modelData.name != controller.currentAirframeType) ? qgcPal.windowShade : qgcPal.buttonHighlight
+ readonly property real titleHeight: ScreenTools.defaultFontPixelHeight * 1.75
+ readonly property real innerMargin: ScreenTools.defaultFontPixelWidth
+
MouseArea {
- anchors.fill: parent
- onClicked: airframeCheckBox.checked = true
+ anchors.fill: parent
+ onClicked: airframeCheckBox.checked = true
}
Rectangle {
@@ -170,36 +178,33 @@ QGCView {
height: parent.titleHeight
color: qgcPal.windowShadeDark
- Text {
- anchors.fill: parent
-
- color: qgcPal.buttonText
- font.pixelSize: 12
- text: modelData.name
-
+ QGCLabel {
+ anchors.fill: parent
+ color: qgcPal.buttonText
verticalAlignment: TextEdit.AlignVCenter
horizontalAlignment: TextEdit.AlignHCenter
+ text: modelData.name
}
}
Image {
- id: image
- x: innerMargin
- width: parent.width - (innerMargin * 2)
- height: parent.height - title.height - combo.height - (innerMargin * 3)
+ id: image
anchors.topMargin: innerMargin
anchors.top: title.bottom
+ x: innerMargin
+ width: parent.width - (innerMargin * 2)
+ height: parent.height - title.height - combo.height - (innerMargin * 3)
+ fillMode: Image.PreserveAspectFit
+ smooth: true
+ source: modelData.imageResource
- source: modelData.imageResource
- fillMode: Image.PreserveAspectFit
- smooth: true
}
QGCCheckBox {
id: airframeCheckBox
anchors.bottom: image.bottom
- anchors.right: image.right
+ anchors.right: image.right
checked: modelData.name == controller.currentAirframeType
exclusiveGroup: airframeTypeExclusive
@@ -214,14 +219,14 @@ QGCView {
}
QGCComboBox {
- id: combo
- objectName: modelData.airframeType + "ComboBox"
- x: innerMargin
- anchors.topMargin: innerMargin
- anchors.top: image.bottom
- width: parent.width - (innerMargin * 2)
- model: modelData.airframes
- currentIndex: (modelData.name == controller.currentAirframeType) ? controller.currentVehicleIndex : -1
+ id: combo
+ objectName: modelData.airframeType + "ComboBox"
+ x: innerMargin
+ anchors.topMargin: innerMargin
+ anchors.top: image.bottom
+ width: parent.width - (innerMargin * 2)
+ currentIndex: (modelData.name == controller.currentAirframeType) ? controller.currentVehicleIndex : -1
+ model: modelData.airframes
onActivated: {
if (index != -1) {
diff --git a/src/AutoPilotPlugins/PX4/FlightModesComponent.qml b/src/AutoPilotPlugins/PX4/FlightModesComponent.qml
index 7b8fdd5fe606f605325918ea8462d88360930d49..7dd4a04cb7c8a2aba06b16465f93111d50695996 100644
--- a/src/AutoPilotPlugins/PX4/FlightModesComponent.qml
+++ b/src/AutoPilotPlugins/PX4/FlightModesComponent.qml
@@ -226,33 +226,39 @@ QGCView {
Item {
id: headingSpacer
anchors.top: header.bottom
- height: 20
+ height: ScreenTools.defaultFontPixelHeight
width: 20
}
- QGCLabel {
- anchors.top: headingSpacer.bottom
- anchors.left: parent.left
- anchors.rightMargin: ScreenTools.defaultFontPixelWidth
- anchors.right: applyButton.left
- text: topHelpText
- wrapMode: Text.WordWrap
- }
-
- QGCButton {
- id: applyButton
- anchors.top: headingSpacer.bottom
- anchors.rightMargin: ScreenTools.defaultFontPixelWidth
- anchors.right: parent.right
- text: "Generate Thresholds"
-
- onClicked: controller.generateThresholds()
+ Item {
+ id: helpApplyRow
+ anchors.top: headingSpacer.bottom
+ width: parent.width
+ height: Math.max(helpText.contentHeight, applyButton.height)
+
+ QGCLabel {
+ id: helpText
+ anchors.rightMargin: ScreenTools.defaultFontPixelWidth
+ anchors.left: parent.left
+ anchors.right: applyButton.left
+ text: topHelpText
+ wrapMode: Text.WordWrap
+ }
+
+ QGCButton {
+ id: applyButton
+ anchors.rightMargin: ScreenTools.defaultFontPixelWidth
+ anchors.right: parent.right
+ text: "Generate Thresholds"
+
+ onClicked: controller.generateThresholds()
+ }
}
Item {
id: lastSpacer
- anchors.top: applyButton.bottom
- height: 20
+ anchors.top: helpApplyRow.bottom
+ height: ScreenTools.defaultFontPixelHeight
width: 10
}
diff --git a/src/AutoPilotPlugins/PX4/PowerComponent.qml b/src/AutoPilotPlugins/PX4/PowerComponent.qml
index ef3a6d0dd78d08449e0feceeddfbd6bcc9c0c142..59fa2e0dc8715fbf06351fa88e89408485cf300f 100644
--- a/src/AutoPilotPlugins/PX4/PowerComponent.qml
+++ b/src/AutoPilotPlugins/PX4/PowerComponent.qml
@@ -40,17 +40,13 @@ QGCView {
id: rootQGCView
viewPanel: panel
- property int firstColumnWidth: 220
- property int textEditWidth: 80
+ property int textEditWidth: ScreenTools.defaultFontPixelWidth * 8
property Fact battNumCells: controller.getParameterFact(-1, "BAT_N_CELLS")
property Fact battHighVolt: controller.getParameterFact(-1, "BAT_V_CHARGED")
property Fact battLowVolt: controller.getParameterFact(-1, "BAT_V_EMPTY")
property Fact battVoltLoadDrop: controller.getParameterFact(-1, "BAT_V_LOAD_DROP")
- property alias battHigh: battHighRow
- property alias battLow: battLowRow
-
function getBatteryImage()
{
switch(battNumCells.value) {
@@ -110,8 +106,8 @@ QGCView {
Column {
- anchors.fill: parent
- spacing: 10
+ anchors.fill: parent
+ spacing: ScreenTools.defaultFontPixelHeight
QGCLabel {
text: "POWER CONFIG"
@@ -124,113 +120,102 @@ QGCView {
}
Rectangle {
- width: parent.width
- height: 120
- color: palette.windowShade
+ width: parent.width
+ height: voltageCol.height + ScreenTools.defaultFontPixelHeight
+ color: palette.windowShade
Column {
- id: batteryColumn
- spacing: 10
- anchors.verticalCenter: parent.verticalCenter
- x: (parent.x + 20)
+ id: voltageCol
+ anchors.margins: ScreenTools.defaultFontPixelHeight / 2
+ anchors.left: parent.left
+ anchors.top: parent.top
+ spacing: ScreenTools.defaultFontPixelHeight / 2
+
+ property real firstColumnWidth: Math.max(Math.max(cellsLabel.contentWidth, battHighLabel.contentWidth), battLowLabel.contentWidth) + ScreenTools.defaultFontPixelWidth
Row {
- spacing: 10
- Column {
- id: voltageCol
- spacing: 10
- Row {
- spacing: 10
- QGCLabel { text: "Number of Cells (in Series)"; width: firstColumnWidth; anchors.baseline: cellsField.baseline}
- FactTextField {
- id: cellsField
- width: textEditWidth
- fact: battNumCells
- showUnits: true
- }
- }
- Row {
- id: battHighRow
- spacing: 10
- QGCLabel { text: "Full Voltage (per cell)"; width: firstColumnWidth; anchors.baseline: battHighField.baseline}
- FactTextField {
- id: battHighField
- width: textEditWidth
- fact: battHighVolt
- showUnits: true
- }
- }
- Row {
- id: battLowRow
- spacing: 10
- QGCLabel { text: "Empty Voltage (per cell)"; width: firstColumnWidth; anchors.baseline: battLowField.baseline}
- FactTextField {
- id: battLowField
- width: textEditWidth
- fact: battLowVolt
- showUnits: true
- }
- }
+ spacing: ScreenTools.defaultFontPixelWidth
+
+ QGCLabel {
+ id: cellsLabel
+ text: "Number of Cells (in Series)"
+ anchors.baseline: cellsField.baseline
}
- Canvas {
- id: arrows
- height: voltageCol.height
- width: 40
- antialiasing: true
- Connections {
- target: ScreenTools
- onRepaintRequested: {
- arrows.requestPaint();
- }
- }
- onPaint: {
- var y0 = voltageCol.mapFromItem(battHigh, 0, battHigh.height / 2).y;
- var y1 = voltageCol.mapFromItem(battLow, 0, battLow.height / 2).y;
- var context = getContext("2d");
- context.reset();
- context.strokeStyle = palette.button;
- context.fillStyle = palette.button;
- drawLineWithArrow(context, 0, y0, width, height * 0.25);
- drawLineWithArrow(context, 0, y1, width, height * 0.85);
+
+ FactTextField {
+ id: cellsField
+ x: voltageCol.firstColumnWidth
+ width: textEditWidth
+ fact: battNumCells
+ showUnits: true
+ }
+ }
+
+ Row {
+ spacing: ScreenTools.defaultFontPixelWidth
+
+ QGCLabel {
+ id: battHighLabel
+ text: "Full Voltage (per cell)"
+ anchors.baseline: battHighField.baseline
}
+
+ FactTextField {
+ id: battHighField
+ x: voltageCol.firstColumnWidth
+ width: textEditWidth
+ fact: battHighVolt
+ showUnits: true
}
- QGCColoredImage {
- height: voltageCol.height
- width: voltageCol.height * 0.75
- source: getBatteryImage();
- fillMode: Image.PreserveAspectFit
- smooth: true
- color: palette.button
- cache: false
+ }
+
+ Row {
+ spacing: ScreenTools.defaultFontPixelWidth
+
+ QGCLabel {
+ id: battLowLabel
+ text: "Empty Voltage (per cell)"
+ anchors.baseline: battLowField.baseline
}
- Item { width: 20; height: 1; }
- Column {
- spacing: 10
- anchors.verticalCenter: parent.verticalCenter
- Row {
- spacing: 10
- QGCLabel {
- text: "Battery Max:"
- width: 80
- }
- QGCLabel {
- text: (battNumCells.value * battHighVolt.value).toFixed(1) + ' V'
- }
- }
- Row {
- spacing: 10
- QGCLabel {
- text: "Battery Min:"
- width: 80
- }
- QGCLabel {
- text: (battNumCells.value * battLowVolt.value).toFixed(1) + ' V'
- }
- }
+
+ FactTextField {
+ id: battLowField
+ x: voltageCol.firstColumnWidth
+ width: textEditWidth
+ fact: battLowVolt
+ showUnits: true
}
}
+ } // Column
+
+ QGCColoredImage {
+ id: batteryImage
+ anchors.verticalCenter: voltageCol.verticalCenter
+ x: voltageCol.firstColumnWidth + textEditWidth + (ScreenTools.defaultFontPixelWidth * 3)
+ width: height * 0.75
+ height: voltageCol.height
+ fillMode: Image.PreserveAspectFit
+ smooth: true
+ color: palette.button
+ cache: false
+ source: getBatteryImage();
}
- }
+
+ Column {
+ anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2
+ anchors.left: batteryImage.right
+ anchors.verticalCenter: voltageCol.verticalCenter
+ spacing: ScreenTools.defaultFontPixelHeight
+
+ QGCLabel {
+ text: "Battery Max: " + (battNumCells.value * battHighVolt.value).toFixed(1) + ' V'
+ }
+
+ QGCLabel {
+ text: "Battery Min: " + (battNumCells.value * battLowVolt.value).toFixed(1) + ' V'
+ }
+ }
+ } // Rectangle - Battery settings
QGCLabel {
text: "ESC Calibration"
@@ -238,14 +223,16 @@ QGCView {
}
Rectangle {
- width: parent.width
- height: 140
- color: palette.windowShade
+ width: parent.width
+ height: escCalColumn.height + ScreenTools.defaultFontPixelHeight
+ color: palette.windowShade
Column {
- anchors.margins: 10
- anchors.fill: parent
- spacing: 10
+ id : escCalColumn
+ anchors.margins: ScreenTools.defaultFontPixelHeight / 2
+ anchors.left: parent.left
+ anchors.top: parent.top
+ spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
color: palette.warningText
@@ -269,14 +256,16 @@ QGCView {
}
Rectangle {
- width: parent.width
- height: 140
- color: palette.windowShade
+ width: parent.width
+ height: uavCanEscCalColumn.height + ScreenTools.defaultFontPixelHeight
+ color: palette.windowShade
Column {
- anchors.margins: 10
- anchors.fill: parent
- spacing: 10
+ id: uavCanEscCalColumn
+ anchors.margins: ScreenTools.defaultFontPixelHeight / 2
+ anchors.left: parent.left
+ anchors.top: parent.top
+ spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
color: palette.warningText
@@ -294,91 +283,69 @@ QGCView {
}
}
- /*
- * This is disabled for now
- Row {
- width: parent.width
- spacing: 30
- visible: showAdvanced.checked
- Column {
- spacing: 10
- width: (parent.width / 2) - 5
- QGCLabel {
- text: "Propeller Function"
- font.pixelSize: ScreenTools.mediumFontPixelSize
- }
- Rectangle {
- width: parent.width
- height: 160
- color: palette.windowShade
- }
- }
- Column {
- spacing: 10
- width: (parent.width / 2) - 5
- QGCLabel {
- text: "Magnetometer Distortion"
- font.pixelSize: ScreenTools.mediumFontPixelSize
- }
- Rectangle {
- width: parent.width
- height: 160
- color: palette.windowShade
- }
-
- }
- }
- */
-
- //-- Advanced Settings
QGCCheckBox {
- id: showAdvanced
- text: "Show Advanced Settings"
+ id: showAdvanced
+ text: "Show Advanced Settings"
}
+
QGCLabel {
text: "Advanced Power Settings"
font.pixelSize: ScreenTools.mediumFontPixelSize
visible: showAdvanced.checked
}
+
Rectangle {
- id: batteryRectangle
- width: parent.width
- height: 140
- color: palette.windowShade
- visible: showAdvanced.checked
+ id: batteryRectangle
+ width: parent.width
+ height: advBatteryColumn.height + ScreenTools.defaultFontPixelHeight
+ color: palette.windowShade
+ visible: showAdvanced.checked
+
Column {
id: advBatteryColumn
- spacing: 10
- anchors.verticalCenter: parent.verticalCenter
- x: (parent.x + 20)
+ anchors.margins: ScreenTools.defaultFontPixelHeight / 2
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+ spacing: ScreenTools.defaultFontPixelWidth
+
Row {
- spacing: 10
- QGCLabel { text: "Voltage Drop on Full Load (per cell)"; width: firstColumnWidth; anchors.baseline: battDropField.baseline}
+ spacing: ScreenTools.defaultFontPixelWidth
+
+ QGCLabel {
+ text: "Voltage Drop on Full Load (per cell)"
+ anchors.baseline: battDropField.baseline
+ }
+
FactTextField {
- id: battDropField
- width: textEditWidth
- fact: battVoltLoadDrop
- showUnits: true
+ id: battDropField
+ width: textEditWidth
+ fact: battVoltLoadDrop
+ showUnits: true
}
}
+
QGCLabel {
- width: batteryRectangle.width - 30
- wrapMode: Text.WordWrap
- text: "Batteries show less voltage at high throttle. Enter the difference in Volts between idle throttle and full " +
- "throttle, divided by the number of battery cells. Leave at the default if unsure. " +
- "If this value is set too high, the battery might be deep discharged and damaged."
+ width: parent.width
+ wrapMode: Text.WordWrap
+ text: "Batteries show less voltage at high throttle. Enter the difference in Volts between idle throttle and full " +
+ "throttle, divided by the number of battery cells. Leave at the default if unsure. " +
+ "If this value is set too high, the battery might be deep discharged and damaged."
}
+
Row {
- spacing: 10
+ spacing: ScreenTools.defaultFontPixelWidth
+
QGCLabel {
text: "Compensated Minimum Voltage:"
}
+
QGCLabel {
text: ((battNumCells.value * battLowVolt.value) - (battNumCells.value * battVoltLoadDrop.value)).toFixed(1) + ' V'
}
}
}
- }
+ } // Rectangle - Advanced power settings
} // Column
} // QGCViewPanel
-}
+} // QGCView
diff --git a/src/AutoPilotPlugins/PX4/SensorsComponent.qml b/src/AutoPilotPlugins/PX4/SensorsComponent.qml
index 0fd3a388904480816e26cbeacea1a0d70666ccad..ddf214c72814c1944880351f053e3e7c01337123 100644
--- a/src/AutoPilotPlugins/PX4/SensorsComponent.qml
+++ b/src/AutoPilotPlugins/PX4/SensorsComponent.qml
@@ -200,7 +200,7 @@ QGCView {
Column {
anchors.fill: parent
- spacing: 10
+ spacing: ScreenTools.defaultFontPixelHeight
QGCLabel {
width: parent.width
@@ -283,12 +283,12 @@ QGCView {
font.pixelSize: ScreenTools.largeFontPixelSize
}
- Item { height: 20; width: 10 } // spacer
+ Item { height: ScreenTools.defaultFontPixelHeight; width: 10 } // spacer
Row {
- readonly property int buttonWidth: 120
+ readonly property int buttonWidth: ScreenTools.defaultFontPixelWidth * 15
- spacing: 20
+ spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { text: "Calibrate:"; anchors.baseline: compassButton.baseline }
@@ -367,17 +367,16 @@ QGCView {
}
}
- Item { height: 20; width: 10 } // spacer
+ Item { height: ScreenTools.defaultFontPixelHeight; width: 10 } // spacer
ProgressBar {
id: progressBar
width: parent.width - rotationColumnWidth
}
- Item { height: 10; width: 10 } // spacer
+ Item { height: ScreenTools.defaultFontPixelHeight; width: 10 } // spacer
Item {
- readonly property int calibrationAreaHeight: 300
property int calDisplayAreaWidth: parent.width - rotationColumnWidth
width: parent.width
@@ -405,25 +404,22 @@ QGCView {
color: qgcPal.windowShade
QGCLabel {
- id: orientationCalAreaHelpText
- width: parent.width
- wrapMode: Text.WordWrap
- font.pixelSize: ScreenTools.mediumFontPixelSize
- anchors.top: orientationCalArea.top
- anchors.left: orientationCalArea.left
- anchors.topMargin: 15
- anchors.leftMargin: 15
- anchors.rightMargin: 15
- anchors.bottomMargin: 15
+ id: orientationCalAreaHelpText
+ anchors.margins: ScreenTools.defaultFontPixelWidth
+ anchors.top: orientationCalArea.top
+ anchors.left: orientationCalArea.left
+ width: parent.width
+ wrapMode: Text.WordWrap
+ font.pixelSize: ScreenTools.mediumFontPixelSize
}
Flow {
- anchors.top: orientationCalAreaHelpText.bottom
- anchors.left: orientationCalAreaHelpText.left
- anchors.topMargin: 15
- width: parent.width
- height: parent.height - orientationCalAreaHelpText.implicitHeight
- spacing: 5
+ anchors.topMargin: ScreenTools.defaultFontPixelWidth
+ anchors.top: orientationCalAreaHelpText.bottom
+ anchors.left: orientationCalAreaHelpText.left
+ width: parent.width
+ height: parent.height - orientationCalAreaHelpText.implicitHeight
+ spacing: ScreenTools.defaultFontPixelWidth
VehicleRotationCal {
visible: controller.orientationCalDownSideVisible
@@ -471,13 +467,13 @@ QGCView {
}
Column {
- anchors.left: orientationCalArea.right
- anchors.leftMargin: 5
- spacing: 20
- x: parent.width - rotationColumnWidth
+ anchors.leftMargin: ScreenTools.defaultFontPixelWidth
+ anchors.left: orientationCalArea.right
+ x: parent.width - rotationColumnWidth
+ spacing: ScreenTools.defaultFontPixelWidth
Column {
- spacing: 5
+ spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
font.pixelSize: sideBarH1PointSize
@@ -499,7 +495,7 @@ QGCView {
}
Column {
- spacing: 5
+ spacing: ScreenTools.defaultFontPixelWidth
// Compass 0 rotation
Component {
@@ -510,6 +506,7 @@ QGCView {
text: "External Compass Orientation"
}
}
+
Component {
id: compass0ComponentCombo2
@@ -520,12 +517,14 @@ QGCView {
fact: cal_mag0_rot
}
}
+
Loader { sourceComponent: showCompass0Rot ? compass0ComponentLabel2 : null }
Loader { sourceComponent: showCompass0Rot ? compass0ComponentCombo2 : null }
}
Column {
- spacing: 5
+ spacing: ScreenTools.defaultFontPixelWidth
+
// Compass 1 rotation
Component {
id: compass1ComponentLabel2
@@ -535,6 +534,7 @@ QGCView {
text: "External Compass 1 Orientation"
}
}
+
Component {
id: compass1ComponentCombo2
@@ -545,12 +545,14 @@ QGCView {
fact: cal_mag1_rot
}
}
+
Loader { sourceComponent: showCompass1Rot ? compass1ComponentLabel2 : null }
Loader { sourceComponent: showCompass1Rot ? compass1ComponentCombo2 : null }
}
Column {
- spacing: 5
+ spacing: ScreenTools.defaultFontPixelWidth
+
// Compass 2 rotation
Component {
id: compass2ComponentLabel2
@@ -560,6 +562,7 @@ QGCView {
text: "Compass 2 Orientation"
}
}
+
Component {
id: compass2ComponentCombo2
diff --git a/src/QmlControls/IndicatorButton.qml b/src/QmlControls/IndicatorButton.qml
index f54b7bd0a79d52f221aaed8f471fabdc6941e9bf..40d8a2ce4bc6c34252f12e4fbcff932aa58c296d 100644
--- a/src/QmlControls/IndicatorButton.qml
+++ b/src/QmlControls/IndicatorButton.qml
@@ -1,8 +1,9 @@
-import QtQuick 2.2
+import QtQuick 2.2
import QtQuick.Controls 1.2
-import QGroundControl.Controls 1.0
-import QGroundControl.Palette 1.0
+import QGroundControl.Controls 1.0
+import QGroundControl.Palette 1.0
+import QGroundControl.ScreenTools 1.0
// An IndicatorButton works just like q QGCButton with the additional support or a red/green
// indicator on the right edge.
@@ -11,14 +12,12 @@ QGCButton {
property bool indicatorGreen: false
Rectangle {
- readonly property real indicatorRadius: 4
-
- x: parent.width - (indicatorRadius * 2) - 5
- y: (parent.height - (indicatorRadius * 2)) / 2
- width: indicatorRadius * 2
- height: indicatorRadius * 2
-
- radius: indicatorRadius
- color: indicatorGreen ? "#00d932" : "red"
+ anchors.rightMargin: ScreenTools.defaultFontPixelWidth / 3
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ width: radius * 2
+ height: width
+ radius: (ScreenTools.defaultFontPixelHeight * .75) / 2
+ color: indicatorGreen ? "#00d932" : "red"
}
}
diff --git a/src/QmlControls/QGCView.qml b/src/QmlControls/QGCView.qml
index 28532ae0bcd41e0fc64156c6bd46f8b53aff9071..c0ded49a5643623e72689ab131b7a4af23ad5f67 100644
--- a/src/QmlControls/QGCView.qml
+++ b/src/QmlControls/QGCView.qml
@@ -121,6 +121,11 @@ FactPanel {
}
}
+ /// Shows a QGCViewDialog component
+ /// @param compoent QGCViewDialog component
+ /// @param title Title for dialog
+ /// @param charWidth Width of dialog in characters (-1 for full parent width)
+ /// @param buttons Buttons to show in dialog using StandardButton enum
function showDialog(component, title, charWidth, buttons) {
if (__checkForEarlyDialog()) {
return
diff --git a/src/QmlControls/SubMenuButton.qml b/src/QmlControls/SubMenuButton.qml
index 576234db8970bc61209890c6a81776426c6bdecb..66aa1fb637c94d98e60ff161dfced6b398f2a65c 100644
--- a/src/QmlControls/SubMenuButton.qml
+++ b/src/QmlControls/SubMenuButton.qml
@@ -1,85 +1,77 @@
-import QtQuick 2.2
-import QtQuick.Controls 1.2
-import QtQuick.Controls.Styles 1.2
-import QtGraphicalEffects 1.0
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2
+import QtGraphicalEffects 1.0
-import QGroundControl.Palette 1.0
-import QGroundControl.ScreenTools 1.0
+import QGroundControl.Palette 1.0
+import QGroundControl.ScreenTools 1.0
Button {
- checkable: true
- height: 60
+ property bool setupComplete: true ///< true: setup complete indicator shows as completed
+ property bool setupIndicator: true ///< true: show setup complete indicator
+ property string imageResource: "/qmlimages/subMenuButtonImage.png" ///< Button image
- text: "Button"
- property bool setupComplete: true
- property bool setupIndicator: true
- property string imageResource: "/qmlimages/subMenuButtonImage.png"
+ text: "Button" ///< Pass in your own button text
+
+ checkable: true
+ height: ScreenTools.defaultFontPixelHeight * 5
style: ButtonStyle {
id: buttonStyle
- property var __qgcPal: QGCPalette {
- colorGroupEnabled: control.enabled
+ QGCPalette {
+ id: qgcPal
+ colorGroupEnabled: control.enabled
}
- property bool __showHighlight: control.pressed | control.checked
+ property bool showHighlight: control.pressed | control.checked
background: Rectangle {
- id: innerRect
- readonly property real titleHeight: 20
-
- color: __showHighlight ? __qgcPal.buttonHighlight : __qgcPal.button
-
- Text {
- id: titleBar
+ id: innerRect
+ color: showHighlight ? qgcPal.buttonHighlight : qgcPal.button
- width: parent.width
- height: parent.titleHeight
+ readonly property real titleHeight: ScreenTools.defaultFontPixelHeight * 1.5
- verticalAlignment: TextEdit.AlignVCenter
- horizontalAlignment: TextEdit.AlignHCenter
-
- text: control.text
- font.pixelSize: ScreenTools.defaultFontPixelSize
- antialiasing: true
- color: __showHighlight ? __qgcPal.buttonHighlightText : __qgcPal.buttonText
+ QGCLabel {
+ id: titleBar
+ width: parent.width
+ height: parent.titleHeight
+ verticalAlignment: TextEdit.AlignVCenter
+ horizontalAlignment: TextEdit.AlignHCenter
+ color: showHighlight ? qgcPal.buttonHighlightText : qgcPal.buttonText
+ text: control.text
Rectangle {
- id: setupIndicator
-
- readonly property real indicatorRadius: 4
-
- x: parent.width - (indicatorRadius * 2) - 3
- y: (parent.height - (indicatorRadius * 2)) / 2
- width: indicatorRadius * 2
- height: indicatorRadius * 2
+ anchors.rightMargin: ScreenTools.defaultFontPixelWidth / 3
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ width: radius * 2
+ height: width
+ radius: indicatorRadius
+ color: control.setupComplete ? "#00d932" : "red"
+ visible: control.setupIndicator
- radius: indicatorRadius
- color: control.setupIndicator ? (control.setupComplete ? "#00d932" : "red") : innerRect.color
+ readonly property real indicatorRadius: (ScreenTools.defaultFontPixelHeight * .75) / 2
}
}
Rectangle {
- width: parent.width
- height: parent.height - parent.titleHeight
-
- y: parent.titleHeight
-
- color: __qgcPal.windowShade
+ anchors.top: titleBar.bottom
+ anchors.bottom: parent.bottom
+ width: parent.width
+ color: qgcPal.windowShade
QGCColoredImage {
- source: control.imageResource
- fillMode: Image.PreserveAspectFit
- width: parent.width - 20
- height: parent.height - 20
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- smooth: true
- color: __showHighlight ? __qgcPal.buttonHighlight : __qgcPal.button
+ anchors.margins: ScreenTools.defaultFontPixelHeight * .75
+ anchors.fill: parent
+ fillMode: Image.PreserveAspectFit
+ smooth: true
+ color: showHighlight ? qgcPal.buttonHighlight : qgcPal.button
+ source: control.imageResource
}
}
}
- label: Item {}
+ label: Item {}
}
}
diff --git a/src/VehicleSetup/VehicleSummary.qml b/src/VehicleSetup/VehicleSummary.qml
index 89154d92f10348d6bad85fa66d16faf5f890eaff..fb918799a03235bde65e4905735968ab33b4a930 100644
--- a/src/VehicleSetup/VehicleSummary.qml
+++ b/src/VehicleSetup/VehicleSummary.qml
@@ -26,36 +26,28 @@ import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QGroundControl.FactSystem 1.0
-import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.MultiVehicleManager 1.0
+import QGroundControl.Palette 1.0
Rectangle {
- width: 600
- height: 400
-
- property var qgcPal: QGCPalette { id: palette; colorGroupEnabled: true }
-
- id: topLevel
- objectName: "topLevel"
-
color: qgcPal.window
+ QGCPalette {
+ id: qgcPal
+ colorGroupEnabled: enabled
+ }
+
Column {
- anchors.fill: parent
+ anchors.fill: parent
+ spacing: ScreenTools.defaultFontPixelHeight
QGCLabel {
text: "VEHICLE SUMMARY"
font.pixelSize: ScreenTools.largeFontPixelSize
}
- Item {
- // Just used as a spacer
- height: 15
- width: 10
- }
-
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
@@ -68,12 +60,6 @@ Rectangle {
property bool setupComplete: multiVehicleManager.activeVehicle.autopilot.setupComplete
}
- Item {
- // Just used as a spacer
- height: 20
- width: 10
- }
-
Flow {
width: parent.width
spacing: ScreenTools.defaultFontPixelWidth
@@ -84,54 +70,48 @@ Rectangle {
// Outer summary item rectangle
Rectangle {
- readonly property real titleHeight: ScreenTools.defaultFontPixelHeight * 2
-
width: ScreenTools.defaultFontPixelWidth * 28
height: ScreenTools.defaultFontPixelHeight * 13
color: qgcPal.windowShade
+ readonly property real titleHeight: ScreenTools.defaultFontPixelHeight * 2
+
// Title bar
Rectangle {
-
- width: parent.width
+ id: titleBar
+ width: parent.width
height: titleHeight
- color: qgcPal.windowShadeDark
+ color: qgcPal.windowShadeDark
// Title text
QGCLabel {
- anchors.fill: parent
-
- color: qgcPal.buttonText
- text: modelData.name.toUpperCase()
-
+ anchors.fill: parent
verticalAlignment: TextEdit.AlignVCenter
horizontalAlignment: TextEdit.AlignHCenter
+ text: modelData.name.toUpperCase()
}
- }
- // Setup indicator
- Rectangle {
- readonly property real indicatorRadius: 6
- readonly property real indicatorRightInset: 5
-
- x: parent.width - (indicatorRadius * 2) - indicatorRightInset
- y: (parent.titleHeight - (indicatorRadius * 2)) / 2
- width: indicatorRadius * 2
- height: indicatorRadius * 2
- radius: indicatorRadius
- color: modelData.setupComplete ? "#00d932" : "red"
+ // Setup indicator
+ Rectangle {
+ anchors.rightMargin: ScreenTools.defaultFontPixelWidth / 3
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ width: 10//radius * 2
+ height: 10//height
+ radius: (ScreenTools.defaultFontPixelHeight * .75) * 2
+ color: modelData.setupComplete ? "#00d932" : "red"
+ visible: modelData.requiresSetup
+ }
}
// Summary Qml
Rectangle {
- y: parent.titleHeight
- width: parent.width
- height: parent.height - parent.titleHeight
- color: qgcPal.windowShade
+ anchors.top: titleBar.bottom
+ width: parent.width
Loader {
- anchors.fill: parent
- source: modelData.summaryQmlSource
+ anchors.fill: parent
+ source: modelData.summaryQmlSource
}
}
}