diff --git a/src/AnalyzeView/LogDownloadPage.qml b/src/AnalyzeView/LogDownloadPage.qml index 4b3d35ad594043f02f96a9e81c1a22c46480347e..298d19e797cfaedb9f4ee580958b9ac87ca8a839 100644 --- a/src/AnalyzeView/LogDownloadPage.qml +++ b/src/AnalyzeView/LogDownloadPage.qml @@ -51,8 +51,7 @@ AnalyzePage { TableView { id: tableView - anchors.top: parent.top - anchors.bottom: parent.bottom + Layout.fillHeight: true model: logController.model selectionMode: SelectionMode.MultiSelection Layout.fillWidth: true diff --git a/src/AnalyzeView/MavlinkConsolePage.qml b/src/AnalyzeView/MavlinkConsolePage.qml index c2dd92a56fa27062a5e5d9b9052e07fdb1106f0e..3f313ee1c5c7b87c4e912411d5aa48e1ecfbc869 100644 --- a/src/AnalyzeView/MavlinkConsolePage.qml +++ b/src/AnalyzeView/MavlinkConsolePage.qml @@ -26,7 +26,7 @@ AnalyzePage { pageName: qsTr("Mavlink Console") pageDescription: qsTr("Mavlink Console provides a connection to the vehicle's system shell.") - property bool loaded: false + property bool isLoaded: false Component { id: pageComponent @@ -41,7 +41,7 @@ AnalyzePage { onDataChanged: { // Keep the view in sync if the button is checked - if (loaded) { + if (isLoaded) { if (followTail.checked) { listview.positionViewAtEnd(); } @@ -69,11 +69,10 @@ AnalyzePage { QGCListView { Component.onCompleted: { - loaded = true + isLoaded = true } Layout.fillHeight: true - anchors.left: parent.left - anchors.right: parent.right + Layout.fillWidth: true clip: true id: listview model: conController @@ -86,8 +85,7 @@ AnalyzePage { } RowLayout { - anchors.left: parent.left - anchors.right: parent.right + Layout.fillWidth: true QGCTextField { id: command Layout.fillWidth: true @@ -114,7 +112,7 @@ AnalyzePage { checked: true onCheckedChanged: { - if (checked && loaded) { + if (checked && isLoaded) { listview.positionViewAtEnd(); } } diff --git a/src/AutoPilotPlugins/PX4/CameraComponent.qml b/src/AutoPilotPlugins/PX4/CameraComponent.qml index a848bb9277c78e258e813313884404b3ae5330c3..2c291d22824e6fc51ff89318d19ddfc6b75eada9 100644 --- a/src/AutoPilotPlugins/PX4/CameraComponent.qml +++ b/src/AutoPilotPlugins/PX4/CameraComponent.qml @@ -121,14 +121,14 @@ SetupPage { } QGCLabel { - anchors.baseline: camTrigCombo.baseline + Layout.alignment: Qt.AlignVCenter text: qsTr("Trigger mode") } FactComboBox { - id: camTrigCombo fact: _camTriggerMode indexModel: false enabled: !_rebooting + Layout.alignment: Qt.AlignVCenter Layout.minimumWidth: _editFieldWidth onActivated: { applyAndRestart.visible = true @@ -136,14 +136,14 @@ SetupPage { } QGCLabel { - anchors.baseline: camInterfaceCombo.baseline + Layout.alignment: Qt.AlignVCenter text: qsTr("Trigger interface") } FactComboBox { - id: camInterfaceCombo fact: _camTriggerInterface indexModel: false enabled: !_rebooting && (_camTriggerInterface ? true : false) + Layout.alignment: Qt.AlignVCenter Layout.minimumWidth: _editFieldWidth onActivated: { applyAndRestart.visible = true @@ -152,7 +152,7 @@ SetupPage { QGCLabel { text: qsTr("Time Interval") - anchors.baseline: timeIntervalField.baseline + Layout.alignment: Qt.AlignVCenter color: qgcPal.text visible: timeIntervalField.visible } @@ -161,12 +161,13 @@ SetupPage { fact: controller.getParameterFact(-1, "TRIG_INTERVAL", false) showUnits: true Layout.minimumWidth: _editFieldWidth + Layout.alignment: Qt.AlignVCenter visible: _camTriggerMode.value === 2 } QGCLabel { text: qsTr("Distance Interval") - anchors.baseline: trigDistField.baseline + Layout.alignment: Qt.AlignVCenter color: qgcPal.text visible: trigDistField.visible } @@ -174,6 +175,7 @@ SetupPage { id: trigDistField fact: controller.getParameterFact(-1, "TRIG_DISTANCE", false) showUnits: true + Layout.alignment: Qt.AlignVCenter Layout.minimumWidth: _editFieldWidth visible: _camTriggerMode.value === 3 } @@ -199,8 +201,8 @@ SetupPage { } Row { - spacing: _margins - anchors.horizontalCenter: parent.horizontalCenter + spacing: _margins + Layout.alignment: Qt.AlignHCenter GridLayout { rows: 2 diff --git a/src/AutoPilotPlugins/PX4/PowerComponent.qml b/src/AutoPilotPlugins/PX4/PowerComponent.qml index ef0f665be9cfbd1b18fb417120bf14495ec207db..3eeec49131fd0703cf030c9746a5c57f0047b32c 100644 --- a/src/AutoPilotPlugins/PX4/PowerComponent.qml +++ b/src/AutoPilotPlugins/PX4/PowerComponent.qml @@ -348,9 +348,9 @@ SetupPage { } // QGCGroupBox - Battery settings QGCGroupBox { - anchors.left: batteryGroup.left - anchors.right: batteryGroup.right - title: qsTr("ESC PWM Minimum and Maximum Calibration") + Layout.maximumWidth: batteryGroup.width + Layout.fillWidth: true + title: qsTr("ESC PWM Minimum and Maximum Calibration") ColumnLayout { anchors.left: parent.left @@ -383,10 +383,10 @@ SetupPage { } QGCGroupBox { - anchors.left: batteryGroup.left - anchors.right: batteryGroup.right - title: qsTr("UAVCAN Bus Configuration") - visible: showUAVCAN.checked + Layout.maximumWidth: batteryGroup.width + Layout.fillWidth: true + title: qsTr("UAVCAN Bus Configuration") + visible: showUAVCAN.checked Row { id: uavCanConfigRow @@ -407,10 +407,10 @@ SetupPage { } QGCGroupBox { - anchors.left: batteryGroup.left - anchors.right: batteryGroup.right - title: qsTr("UAVCAN Motor Index and Direction Assignment") - visible: showUAVCAN.checked + Layout.maximumWidth: batteryGroup.width + Layout.fillWidth: true + title: qsTr("UAVCAN Motor Index and Direction Assignment") + visible: showUAVCAN.checked ColumnLayout { anchors.left: parent.left @@ -456,10 +456,10 @@ SetupPage { } QGCGroupBox { - anchors.left: batteryGroup.left - anchors.right: batteryGroup.right - title: qsTr("Advanced Power Settings") - visible: showAdvanced.checked + Layout.maximumWidth: batteryGroup.width + Layout.fillWidth: true + title: qsTr("Advanced Power Settings") + visible: showAdvanced.checked ColumnLayout { anchors.left: parent.left @@ -487,7 +487,7 @@ SetupPage { text: qsTr("Batteries show less voltage at high throttle. Enter the difference in Volts between idle throttle and full ") + qsTr("throttle, divided by the number of battery cells. Leave at the default if unsure. ") + highlightPrefix + qsTr("If this value is set too high, the battery might be deep discharged and damaged.") + highlightSuffix - Layout.fillWidth: true + Layout.maximumWidth: ScreenTools.defaultFontPixelWidth * 60 } Row { diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index 3506a3e8cc7de15919fd626522cd45ceb08a91fa..a37c3269fb6b267dd5ada7166c6c608fb8768d76 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -193,9 +193,9 @@ QGCView { QGCButton { Layout.fillWidth: true + Layout.alignment: Qt.AlignHCenter text: qsTr("Leave plan on vehicle") - anchors.horizontalCenter: parent.horizontalCenter - onClicked: hideDialog() + onClicked: hideDialog() } } } diff --git a/src/FlightDisplay/MultiVehicleList.qml b/src/FlightDisplay/MultiVehicleList.qml index 4c62a4f1cd7aa4a421faf7b541703c75e95967d0..82f799661566095626dc1bc40474e4553898f62b 100644 --- a/src/FlightDisplay/MultiVehicleList.qml +++ b/src/FlightDisplay/MultiVehicleList.qml @@ -107,8 +107,7 @@ Item { spacing: _margin RowLayout { - anchors.left: parent.left - anchors.right: parent.left + Layout.fillWidth: true QGCLabel { Layout.alignment: Qt.AlignTop @@ -121,14 +120,14 @@ Item { spacing: _margin FlightModeMenu { - anchors.horizontalCenter: parent.horizontalCenter + Layout.alignment: Qt.AlignHCenter font.pointSize: ScreenTools.largeFontPointSize color: _textColor activeVehicle: _vehicle } QGCLabel { - anchors.horizontalCenter: parent.horizontalCenter + Layout.alignment: Qt.AlignHCenter text: _vehicle.armed ? qsTr("Armed") : qsTr("Disarmed") color: _textColor } diff --git a/src/PlanView/PlanToolBar.qml b/src/PlanView/PlanToolBar.qml index c6dd3a0276e3ee6fcc744708355316f2e4633469..3487257f0eec2dc4fc3b1d2aa1568b4c47a6d16b 100644 --- a/src/PlanView/PlanToolBar.qml +++ b/src/PlanView/PlanToolBar.qml @@ -157,11 +157,10 @@ Rectangle { columns: 3 GridLayout { - anchors.verticalCenter: parent.verticalCenter columns: 8 rowSpacing: _rowSpacing columnSpacing: _labelToValueSpacing - Layout.alignment: Qt.AlignHCenter + Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter QGCLabel { text: qsTr("Selected Waypoint") @@ -212,11 +211,10 @@ Rectangle { } GridLayout { - anchors.verticalCenter: parent.verticalCenter columns: 5 rowSpacing: _rowSpacing columnSpacing: _labelToValueSpacing - Layout.alignment: Qt.AlignHCenter + Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter QGCLabel { text: qsTr("Total Mission") @@ -249,11 +247,10 @@ Rectangle { } GridLayout { - anchors.verticalCenter: parent.verticalCenter columns: 3 rowSpacing: _rowSpacing columnSpacing: _labelToValueSpacing - Layout.alignment: Qt.AlignHCenter + Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter visible: _batteryInfoAvailable QGCLabel { diff --git a/src/PlanView/SectionHeader.qml b/src/PlanView/SectionHeader.qml index 9f0b6b8a7a582e3f0d9ef43dd17607f7b6559f2d..7903a7c4fd3e784697ec014a8918a7b89e85943d 100644 --- a/src/PlanView/SectionHeader.qml +++ b/src/PlanView/SectionHeader.qml @@ -46,16 +46,14 @@ FocusScope { } QGCLabel { - id: label - anchors.left: parent.left - anchors.right: parent.right + id: label + Layout.fillWidth: true QGCColoredImage { id: image width: label.height / 2 height: width - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter + Layout.alignment: Qt.AlignRight | Qt.AlignVCenter source: "/qmlimages/arrow-down.png" color: qgcPal.text visible: !_root.checked @@ -63,10 +61,9 @@ FocusScope { } Rectangle { - anchors.left: parent.left - anchors.right: parent.right - height: 1 - color: qgcPal.text + Layout.fillWidth: true + height: 1 + color: qgcPal.text } } } diff --git a/src/PlanView/SurveyItemEditor.qml b/src/PlanView/SurveyItemEditor.qml index d04115b6b3ee8dff2251f620b3ac6db8590bca1e..4de4402dd6d302dff34ca29fd060dba7c3333fa2 100644 --- a/src/PlanView/SurveyItemEditor.qml +++ b/src/PlanView/SurveyItemEditor.qml @@ -139,7 +139,7 @@ Rectangle { QGCCheckBox { id: relAlt - anchors.left: parent.left + Layout.alignment: Qt.AlignLeft text: qsTr("Relative altitude") checked: missionItem.cameraCalc.distanceToSurfaceRelative enabled: missionItem.cameraCalc.isManualCamera && !missionItem.followTerrain @@ -173,12 +173,11 @@ Rectangle { } GridLayout { - anchors.left: parent.left - anchors.right: parent.right - columnSpacing: _margin - rowSpacing: _margin - columns: 2 - visible: followsTerrainCheckBox.checked + Layout.fillWidth: true + columnSpacing: _margin + rowSpacing: _margin + columns: 2 + visible: followsTerrainCheckBox.checked QGCLabel { text: qsTr("Tolerance") } FactTextField { diff --git a/src/QmlControls/QGCTextField.qml b/src/QmlControls/QGCTextField.qml index f1a78e0b0355e17f00b6316d46cde021ea4f41e8..422a4ffaa24be088aad63f54951c61f6c708fb32 100644 --- a/src/QmlControls/QGCTextField.qml +++ b/src/QmlControls/QGCTextField.qml @@ -77,7 +77,7 @@ TextField { onWidthChanged: control._helpLayoutWidth = unitsHelpLayout.width Text { - anchors.verticalCenter: parent.verticalCenter + Layout.alignment: Qt.AlignVCenter text: control.unitsLabel font.pointSize: backgroundItem.showHelp ? ScreenTools.smallFontPointSize : ScreenTools.defaultFontPointSize font.family: ScreenTools.normalFontFamily @@ -87,10 +87,9 @@ TextField { } Rectangle { - anchors.margins: 2 - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.right: parent.right + Layout.margins: 2 + Layout.fillHeight: true + Layout.alignment: Qt.AlignRight width: height * 0.75 color: control.textColor radius: 2 diff --git a/src/VehicleSetup/SetupView.qml b/src/VehicleSetup/SetupView.qml index 9b94e26c72a696d83d3ecf87b62fc3b82a605b73..49de138d581f98e6cceb16b0fa27d601e67341d4 100644 --- a/src/VehicleSetup/SetupView.qml +++ b/src/VehicleSetup/SetupView.qml @@ -210,8 +210,7 @@ Rectangle { spacing: _defaultTextHeight / 2 QGCLabel { - anchors.left: parent.left - anchors.right: parent.right + Layout.fillWidth: true text: qsTr("Vehicle Setup") wrapMode: Text.WordWrap horizontalAlignment: Text.AlignHCenter diff --git a/src/ui/AppSettings.qml b/src/ui/AppSettings.qml index 3b9d5a02972b80eaeca5525092d2d915af022959..3f1f533e337cf53501891a1e8659b5cce43f570c 100644 --- a/src/ui/AppSettings.qml +++ b/src/ui/AppSettings.qml @@ -58,8 +58,7 @@ Rectangle { property real _maxButtonWidth: 0 QGCLabel { - anchors.left: parent.left - anchors.right: parent.right + Layout.fillWidth: true text: qsTr("Application Settings") wrapMode: Text.WordWrap horizontalAlignment: Text.AlignHCenter diff --git a/src/ui/preferences/GeneralSettings.qml b/src/ui/preferences/GeneralSettings.qml index 70aa6cb082c3aa9d0ae5b17cd66a5bac2ae4598d..124d440a9504512eaec1108d10d61e5a9179dd25 100644 --- a/src/ui/preferences/GeneralSettings.qml +++ b/src/ui/preferences/GeneralSettings.qml @@ -385,11 +385,11 @@ QGCView { visible: _savePath.visible && !ScreenTools.isMobile QGCLabel { - anchors.baseline: savePathBrowse.baseline - text: qsTr("File Save Path:") + Layout.alignment: Qt.AlignVCenter + text: qsTr("File Save Path:") } QGCLabel { - anchors.baseline: savePathBrowse.baseline + Layout.alignment: Qt.AlignVCenter Layout.maximumWidth: _panelWidth * 0.5 elide: Text.ElideMiddle text: _savePath.rawValue === "" ? qsTr("") : _savePath.value diff --git a/src/ui/toolbar/MainToolBar.qml b/src/ui/toolbar/MainToolBar.qml index e1639270f21734e056b27c0ad6c2f82202612fae..7d737e0f66cc4c1919f597d291649920a9b8b02a 100644 --- a/src/ui/toolbar/MainToolBar.qml +++ b/src/ui/toolbar/MainToolBar.qml @@ -81,10 +81,9 @@ Rectangle { //--------------------------------------------- // Toolbar Row Row { - id: viewRow - anchors.top: parent.top - anchors.bottom: parent.bottom - spacing: ScreenTools.defaultFontPixelWidth / 2 + id: viewRow + Layout.fillHeight: true + spacing: ScreenTools.defaultFontPixelWidth / 2 ExclusiveGroup { id: mainActionGroup } @@ -153,7 +152,7 @@ Rectangle { width: ScreenTools.defaultFontPixelHeight * 8 text: "Vehicle " + (_activeVehicle ? _activeVehicle.id : "None") visible: QGroundControl.multiVehicleManager.vehicles.count > 1 - anchors.verticalCenter: parent.verticalCenter + Layout.alignment: Qt.AlignVCenter menu: vehicleMenu @@ -175,14 +174,15 @@ Rectangle { property var vehicleMenuItems: [] function updateVehicleMenu() { + var i; // Remove old menu items - for (var i = 0; i < vehicleMenuItems.length; i++) { + for (i = 0; i < vehicleMenuItems.length; i++) { vehicleMenu.removeItem(vehicleMenuItems[i]) } vehicleMenuItems.length = 0 // Add new items - for (var i=0; i