diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index 7cc04b763e788e02ab56289f02c501a60e77d220..6c60bb2ab9e5ed8334a36eb6b8259d29bb9bfea5 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -488,13 +488,13 @@ QGCView { exclusiveGroup: multiVehicleSelectorGroup text: qsTr("Single") checked: true - color: mapPal.text + textColor: mapPal.text } QGCRadioButton { exclusiveGroup: multiVehicleSelectorGroup text: qsTr("Multi-Vehicle") - color: mapPal.text + textColor: mapPal.text } } diff --git a/src/MissionManager/QGCMapCircle.Facts.json b/src/MissionManager/QGCMapCircle.Facts.json index f2ded5e5efea285b70279064ba7ed926e4d11456..2f496fa1d48a4054595d39c758f136c9beea4c09 100644 --- a/src/MissionManager/QGCMapCircle.Facts.json +++ b/src/MissionManager/QGCMapCircle.Facts.json @@ -3,7 +3,7 @@ "name": "Radius", "shortDescription": "Radius for geofence circle.", "type": "double", - "decimalPlaces": 2, + "decimalPlaces": 1, "min": 0.1, "units": "m" } diff --git a/src/PlanView/GeoFenceEditor.qml b/src/PlanView/GeoFenceEditor.qml index b5d12f23fa91c6da37496d6f63449f237c50361f..9788aea347a030ac59dbf6733fea0080641d8e02 100644 --- a/src/PlanView/GeoFenceEditor.qml +++ b/src/PlanView/GeoFenceEditor.qml @@ -10,13 +10,9 @@ import QGroundControl.FactControls 1.0 QGCFlickable { id: root - width: availableWidth - height: availableHeight - contentHeight: editorColumn.height + contentHeight: geoFenceEditorRect.height clip: true - property real availableWidth - property real availableHeight property var myGeoFenceController property var flightMap @@ -24,317 +20,290 @@ QGCFlickable { readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2 readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2 - Column { - id: editorColumn + Rectangle { + id: geoFenceEditorRect anchors.left: parent.left anchors.right: parent.right + height: geoFenceItems.y + geoFenceItems.height + (_margin * 2) + radius: _radius + color: qgcPal.missionItemEditor + + QGCLabel { + id: geoFenceLabel + anchors.margins: _margin + anchors.left: parent.left + anchors.top: parent.top + text: qsTr("GeoFence") + anchors.leftMargin: ScreenTools.defaultFontPixelWidth + } Rectangle { - id: geoFenceEditorRect - width: parent.width - height: geoFenceItems.y + geoFenceItems.height + (_margin * 2) - radius: _radius - color: qgcPal.missionItemEditor - - QGCLabel { - id: geoFenceLabel + id: geoFenceItems + anchors.margins: _margin + anchors.left: parent.left + anchors.right: parent.right + anchors.top: geoFenceLabel.bottom + height: fenceColumn.y + fenceColumn.height + (_margin * 2) + color: qgcPal.windowShadeDark + radius: _radius + + Column { + id: fenceColumn anchors.margins: _margin - anchors.left: parent.left anchors.top: parent.top - text: qsTr("GeoFence") - anchors.leftMargin: ScreenTools.defaultFontPixelWidth - } - - Rectangle { - id: geoFenceItems - anchors.margins: _margin anchors.left: parent.left anchors.right: parent.right - anchors.top: geoFenceLabel.bottom - height: fenceColumn.y + fenceColumn.height + (_margin * 2) - color: qgcPal.windowShadeDark - radius: _radius + spacing: ScreenTools.defaultFontPixelHeight / 2 - Column { - id: fenceColumn - anchors.margins: _margin - anchors.top: parent.top + QGCLabel { anchors.left: parent.left anchors.right: parent.right - spacing: ScreenTools.defaultFontPixelHeight / 2 - - QGCLabel { - anchors.left: parent.left - anchors.right: parent.right - wrapMode: Text.WordWrap - font.pointSize: myGeoFenceController.supported ? ScreenTools.smallFontPointSize : ScreenTools.defaultFontPointSize - text: myGeoFenceController.supported ? - qsTr("GeoFencing allows you to set a virtual ‘fence’ around the area you want to fly in.") : - qsTr("This vehicle does not support GeoFence.") - } + wrapMode: Text.WordWrap + font.pointSize: myGeoFenceController.supported ? ScreenTools.smallFontPointSize : ScreenTools.defaultFontPointSize + text: myGeoFenceController.supported ? + qsTr("GeoFencing allows you to set a virtual ‘fence’ around the area you want to fly in.") : + qsTr("This vehicle does not support GeoFence.") + } - Column { - anchors.left: parent.left - anchors.right: parent.right - spacing: ScreenTools.defaultFontPixelHeight / 2 - visible: myGeoFenceController.supported + Column { + anchors.left: parent.left + anchors.right: parent.right + spacing: ScreenTools.defaultFontPixelHeight / 2 + visible: myGeoFenceController.supported - Repeater { - model: myGeoFenceController.params + Repeater { + model: myGeoFenceController.params - Item { - width: fenceColumn.width - height: textField.height + Item { + width: fenceColumn.width + height: textField.height - property bool showCombo: modelData.enumStrings.length > 0 + property bool showCombo: modelData.enumStrings.length > 0 - QGCLabel { - id: textFieldLabel - anchors.baseline: textField.baseline - text: myGeoFenceController.paramLabels[index] - } + QGCLabel { + id: textFieldLabel + anchors.baseline: textField.baseline + text: myGeoFenceController.paramLabels[index] + } - FactTextField { - id: textField - anchors.right: parent.right - width: _editFieldWidth - showUnits: true - fact: modelData - visible: !parent.showCombo - } + FactTextField { + id: textField + anchors.right: parent.right + width: _editFieldWidth + showUnits: true + fact: modelData + visible: !parent.showCombo + } - FactComboBox { - id: comboField - anchors.right: parent.right - width: _editFieldWidth - indexModel: false - fact: showCombo ? modelData : _nullFact - visible: parent.showCombo + FactComboBox { + id: comboField + anchors.right: parent.right + width: _editFieldWidth + indexModel: false + fact: showCombo ? modelData : _nullFact + visible: parent.showCombo - property var _nullFact: Fact { } - } + property var _nullFact: Fact { } } } + } - SectionHeader { - id: insertSection - text: qsTr("Insert GeoFence") - } + SectionHeader { + id: insertSection + text: qsTr("Insert GeoFence") + } - QGCButton { - anchors.left: parent.left - anchors.right: parent.right - text: qsTr("Polygon Fence") + QGCButton { + anchors.left: parent.left + anchors.right: parent.right + text: qsTr("Polygon Fence") - onClicked: { - var rect = Qt.rect(flightMap.centerViewport.x, flightMap.centerViewport.y, flightMap.centerViewport.width, flightMap.centerViewport.height) - var topLeftCoord = flightMap.toCoordinate(Qt.point(rect.x, rect.y), false /* clipToViewPort */) - var bottomRightCoord = flightMap.toCoordinate(Qt.point(rect.x + rect.width, rect.y + rect.height), false /* clipToViewPort */) - myGeoFenceController.addInclusionPolygon(topLeftCoord, bottomRightCoord) - } + onClicked: { + var rect = Qt.rect(flightMap.centerViewport.x, flightMap.centerViewport.y, flightMap.centerViewport.width, flightMap.centerViewport.height) + var topLeftCoord = flightMap.toCoordinate(Qt.point(rect.x, rect.y), false /* clipToViewPort */) + var bottomRightCoord = flightMap.toCoordinate(Qt.point(rect.x + rect.width, rect.y + rect.height), false /* clipToViewPort */) + myGeoFenceController.addInclusionPolygon(topLeftCoord, bottomRightCoord) } + } - QGCButton { - anchors.left: parent.left - anchors.right: parent.right - text: qsTr("Circular Fence") + QGCButton { + anchors.left: parent.left + anchors.right: parent.right + text: qsTr("Circular Fence") - onClicked: { - var rect = Qt.rect(flightMap.centerViewport.x, flightMap.centerViewport.y, flightMap.centerViewport.width, flightMap.centerViewport.height) - var topLeftCoord = flightMap.toCoordinate(Qt.point(rect.x, rect.y), false /* clipToViewPort */) - var bottomRightCoord = flightMap.toCoordinate(Qt.point(rect.x + rect.width, rect.y + rect.height), false /* clipToViewPort */) - myGeoFenceController.addInclusionCircle(topLeftCoord, bottomRightCoord) - } + onClicked: { + var rect = Qt.rect(flightMap.centerViewport.x, flightMap.centerViewport.y, flightMap.centerViewport.width, flightMap.centerViewport.height) + var topLeftCoord = flightMap.toCoordinate(Qt.point(rect.x, rect.y), false /* clipToViewPort */) + var bottomRightCoord = flightMap.toCoordinate(Qt.point(rect.x + rect.width, rect.y + rect.height), false /* clipToViewPort */) + myGeoFenceController.addInclusionCircle(topLeftCoord, bottomRightCoord) } + } - SectionHeader { - id: polygonSection - text: qsTr("Polygon Fences") - } + SectionHeader { + id: polygonSection + text: qsTr("Polygon Fences") + } + + QGCLabel { + text: qsTr("None") + visible: polygonSection.checked && myGeoFenceController.polygons.count === 0 + } + + GridLayout { + anchors.left: parent.left + anchors.right: parent.right + columns: 3 + flow: GridLayout.TopToBottom + visible: polygonSection.checked && myGeoFenceController.polygons.count > 0 QGCLabel { - text: qsTr("None") - visible: polygonSection.checked && myGeoFenceController.polygons.count === 0 + text: qsTr("Inclusion") + Layout.column: 0 + Layout.alignment: Qt.AlignHCenter } - GridLayout { - anchors.left: parent.left - anchors.right: parent.right - columns: 3 - flow: GridLayout.TopToBottom - visible: polygonSection.checked && myGeoFenceController.polygons.count > 0 + Repeater { + model: myGeoFenceController.polygons - QGCLabel { - text: qsTr("Inclusion") - Layout.column: 0 + QGCCheckBox { + checked: object.inclusion + onClicked: object.inclusion = checked Layout.alignment: Qt.AlignHCenter } + } - Repeater { - model: myGeoFenceController.polygons + QGCLabel { + text: qsTr("Edit") + Layout.column: 1 + Layout.alignment: Qt.AlignHCenter + } - QGCCheckBox { - checked: object.inclusion - onClicked: object.inclusion = checked - Layout.alignment: Qt.AlignHCenter - } - } + Repeater { + model: myGeoFenceController.polygons - QGCLabel { - text: qsTr("Edit") - Layout.column: 1 + QGCRadioButton { + checked: _interactive Layout.alignment: Qt.AlignHCenter - } - - Repeater { - model: myGeoFenceController.polygons - - QGCRadioButton { - checked: _interactive - Layout.alignment: Qt.AlignHCenter - property bool _interactive: object.interactive + property bool _interactive: object.interactive - on_InteractiveChanged: checked = _interactive + on_InteractiveChanged: checked = _interactive - onClicked: { - myGeoFenceController.clearAllInteractive() - object.interactive = checked - } + onClicked: { + myGeoFenceController.clearAllInteractive() + object.interactive = checked } } + } - QGCLabel { - text: qsTr("Delete") - Layout.column: 2 - Layout.alignment: Qt.AlignHCenter - } + QGCLabel { + text: qsTr("Delete") + Layout.column: 2 + Layout.alignment: Qt.AlignHCenter + } - Repeater { - model: myGeoFenceController.polygons + Repeater { + model: myGeoFenceController.polygons - QGCColoredImage { - width: ScreenTools.defaultFontPixelHeight - height: width - sourceSize.height: width - source: "/res/XDelete.svg" - fillMode: Image.PreserveAspectFit - color: qgcPal.text - Layout.alignment: Qt.AlignHCenter + QGCButton { + text: qsTr("Del") + Layout.alignment: Qt.AlignHCenter + onClicked: myGeoFenceController.deletePolygon(index) + } + } + } // GridLayout - property int _polygonIndex: index + SectionHeader { + id: circleSection + text: qsTr("Circular Fences") + } - QGCMouseArea { - fillItem: parent - onClicked: myGeoFenceController.deletePolygon(parent._polygonIndex) - } - } - } - } // GridLayout + QGCLabel { + text: qsTr("None") + visible: circleSection.checked && myGeoFenceController.circles.count === 0 + } - SectionHeader { - id: circleSection - text: qsTr("Circular Fences") - } + GridLayout { + anchors.left: parent.left + anchors.right: parent.right + columns: 4 + flow: GridLayout.TopToBottom + visible: polygonSection.checked && myGeoFenceController.circles.count > 0 QGCLabel { - text: qsTr("None") - visible: circleSection.checked && myGeoFenceController.circles.count === 0 + text: qsTr("Inclusion") + Layout.column: 0 + Layout.alignment: Qt.AlignHCenter } - GridLayout { - anchors.left: parent.left - anchors.right: parent.right - columns: 4 - flow: GridLayout.TopToBottom - visible: polygonSection.checked && myGeoFenceController.circles.count > 0 + Repeater { + model: myGeoFenceController.circles - QGCLabel { - text: qsTr("Inclusion") - Layout.column: 0 + QGCCheckBox { + checked: object.inclusion + onClicked: object.inclusion = checked Layout.alignment: Qt.AlignHCenter } + } - Repeater { - model: myGeoFenceController.circles + QGCLabel { + text: qsTr("Edit") + Layout.column: 1 + Layout.alignment: Qt.AlignHCenter + } - QGCCheckBox { - checked: object.inclusion - onClicked: object.inclusion = checked - Layout.alignment: Qt.AlignHCenter - } - } + Repeater { + model: myGeoFenceController.circles - QGCLabel { - text: qsTr("Edit") - Layout.column: 1 + QGCRadioButton { + checked: _interactive Layout.alignment: Qt.AlignHCenter - } - - Repeater { - model: myGeoFenceController.circles - QGCRadioButton { - checked: _interactive - Layout.alignment: Qt.AlignHCenter + property bool _interactive: object.interactive - property bool _interactive: object.interactive + on_InteractiveChanged: checked = _interactive - on_InteractiveChanged: checked = _interactive - - onClicked: { - myGeoFenceController.clearAllInteractive() - object.interactive = checked - } + onClicked: { + myGeoFenceController.clearAllInteractive() + object.interactive = checked } } + } - QGCLabel { - text: qsTr("Radius") - Layout.column: 2 - Layout.alignment: Qt.AlignHCenter - } - - Repeater { - model: myGeoFenceController.circles + QGCLabel { + text: qsTr("Radius") + Layout.column: 2 + Layout.alignment: Qt.AlignHCenter + } - FactTextField { - fact: object.radius - Layout.fillWidth: true - Layout.alignment: Qt.AlignHCenter - } - } + Repeater { + model: myGeoFenceController.circles - QGCLabel { - text: qsTr("Delete") - Layout.column: 3 + FactTextField { + fact: object.radius + Layout.fillWidth: true Layout.alignment: Qt.AlignHCenter } + } - Repeater { - model: myGeoFenceController.circles - - QGCColoredImage { - width: ScreenTools.defaultFontPixelHeight - height: width - sourceSize.height: width - source: "/res/XDelete.svg" - fillMode: Image.PreserveAspectFit - color: qgcPal.text - Layout.alignment: Qt.AlignHCenter + QGCLabel { + text: qsTr("Delete") + Layout.column: 3 + Layout.alignment: Qt.AlignHCenter + } - property int _circleIndex: index + Repeater { + model: myGeoFenceController.circles - QGCMouseArea { - fillItem: parent - onClicked: myGeoFenceController.deleteCircle(parent._polygonIndex) - } - } + QGCButton { + text: qsTr("Del") + Layout.alignment: Qt.AlignHCenter + onClicked: myGeoFenceController.deleteCircle(index) } - } // GridLayout - } + } + } // GridLayout } } - } // Rectangle - } + } + } // Rectangle } diff --git a/src/PlanView/MissionItemEditor.qml b/src/PlanView/MissionItemEditor.qml index 511e6898f6353e67ab2f2bf655912cba40839eea..694eecb93db4c8f62d9d8f3db7d6efb0f07e46fa 100644 --- a/src/PlanView/MissionItemEditor.qml +++ b/src/PlanView/MissionItemEditor.qml @@ -15,7 +15,7 @@ import QGroundControl.Palette 1.0 /// Mission item edit control Rectangle { id: _root - height: editorLoader.y + (editorLoader.visible ? editorLoader.height : 0) + (_margin * 2) + height: editorLoader.visible ? (editorLoader.y + editorLoader.height + (_margin * 2)) : (commandPicker.y + commandPicker.height + _margin / 2) color: _currentItem ? qgcPal.missionItemEditor : qgcPal.windowShade radius: _radius @@ -90,8 +90,7 @@ Rectangle { sourceSize.height: _hamburgerSize source: "qrc:/qmlimages/Hamburger.svg" visible: missionItem.isCurrentItem && missionItem.sequenceNumber !== 0 - color: qgcPal.windowShade - + color: qgcPal.text } QGCMouseArea { diff --git a/src/PlanView/PlanView.qml b/src/PlanView/PlanView.qml index d03f08d4fb1825175370c4664414084355281469..15f81051084a0e17a4f27c23f544907f47fe33a4 100644 --- a/src/PlanView/PlanView.qml +++ b/src/PlanView/PlanView.qml @@ -760,14 +760,6 @@ QGCView { anchors.left: parent.left anchors.leftMargin: ScreenTools.defaultFontPixelWidth readonly property real _buttonRadius: ScreenTools.defaultFontPixelHeight * 0.75 - QGCColoredImage { - width: height - height: ScreenTools.defaultFontPixelWidth * 2.5 - sourceSize.height: height - source: "qrc:/res/waypoint.svg" - color: qgcPal.text - anchors.verticalCenter: parent.verticalCenter - } QGCLabel { text: qsTr("Plan") color: qgcPal.text @@ -831,7 +823,7 @@ QGCView { QGCListView { id: missionItemEditorListView anchors.fill: parent - spacing: ScreenTools.defaultFontPixelHeight * 0.5 + spacing: ScreenTools.defaultFontPixelHeight / 4 orientation: ListView.Vertical model: _missionController.visualItems cacheBuffer: Math.max(height * 2, 0) @@ -865,9 +857,9 @@ QGCView { GeoFenceEditor { anchors.top: rightControls.bottom anchors.topMargin: ScreenTools.defaultFontPixelHeight * 0.5 + anchors.bottom: parent.bottom anchors.left: parent.left anchors.right: parent.right - availableHeight: ScreenTools.availableHeight myGeoFenceController: _geoFenceController flightMap: editorMap visible: _editingLayer == _layerGeoFence diff --git a/src/PlanView/RallyPointItemEditor.qml b/src/PlanView/RallyPointItemEditor.qml index a85c84b7395e8898ab4dff84c681e420f8bb921c..9ec63847a3e4b813db249765b7d25f4d98126362 100644 --- a/src/PlanView/RallyPointItemEditor.qml +++ b/src/PlanView/RallyPointItemEditor.qml @@ -50,7 +50,7 @@ Rectangle { color: _outerTextColor } - Image { + QGCColoredImage { id: hamburger anchors.rightMargin: _margin anchors.right: parent.right @@ -59,6 +59,7 @@ Rectangle { height: width sourceSize.height: height source: "qrc:/qmlimages/Hamburger.svg" + color: qgcPal.text MouseArea { anchors.fill: parent diff --git a/src/PositionManager/PositionManager.cpp b/src/PositionManager/PositionManager.cpp index 146749ca34ae0cbc0cc39227dcaaa3d304cee0fc..09f485142162f1ca634be70045d1fec08b4edda7 100644 --- a/src/PositionManager/PositionManager.cpp +++ b/src/PositionManager/PositionManager.cpp @@ -36,7 +36,6 @@ void QGCPositionManager::setToolbox(QGCToolbox *toolbox) if(!_defaultSource) { //-- Otherwise, create a default one _defaultSource = QGeoPositionInfoSource::createDefaultSource(this); - qDebug() << _defaultSource; } _simulatedSource = new SimulatedPosition(); diff --git a/src/QmlControls/QGCCheckBox.qml b/src/QmlControls/QGCCheckBox.qml index 5dbfb55053e844a1024289677258c1220353def7..9292f7cac49612d985d5a9f73bddd115efa6682f 100644 --- a/src/QmlControls/QGCCheckBox.qml +++ b/src/QmlControls/QGCCheckBox.qml @@ -6,96 +6,50 @@ import QGroundControl.Palette 1.0 import QGroundControl.ScreenTools 1.0 CheckBox { - activeFocusOnPress: true + property color textColor: _qgcPal.text + property bool textBold: false + property real textFontPointSize: ScreenTools.defaultFontPointSize + + property var _qgcPal: QGCPalette { colorGroupEnabled: enabled } + property bool _noText: text === "" + property real _radius: ScreenTools.defaultFontPixelHeight * 0.16 - property var __qgcPal: QGCPalette { colorGroupEnabled: enabled } + activeFocusOnPress: true style: CheckBoxStyle { label: Item { - implicitWidth: text.implicitWidth + 2 - implicitHeight: ScreenTools.implicitCheckBoxHeight + implicitWidth: _noText ? 0 : text.implicitWidth + ScreenTools.defaultFontPixelWidth * 0.25 + implicitHeight: _noText ? 0 : Math.max(text.implicitHeight, ScreenTools.checkBoxIndicatorSize) baselineOffset: text.baselineOffset - Rectangle { - anchors.margins: -1 - anchors.leftMargin: -3 - anchors.rightMargin: -3 - anchors.fill: text - visible: control.activeFocus - height: 6 - radius: 3 - color: "#224f9fef" - border.color: "#47b" - opacity: 0.6 - } - Text { - id: text - text: control.text - antialiasing: true - font.pointSize: ScreenTools.defaultFontPointSize - font.family: ScreenTools.normalFontFamily - color: control.__qgcPal.text - anchors.verticalCenter: parent.verticalCenter + id: text + text: control.text + font.pointSize: textFontPointSize + font.bold: control.textBold + color: control.textColor + anchors.centerIn: parent } - } // label + } indicator: Item { implicitWidth: ScreenTools.checkBoxIndicatorSize implicitHeight: implicitWidth Rectangle { - anchors.fill: parent - anchors.bottomMargin: -1 - color: "#44ffffff" - radius: baserect.radius - } - - Rectangle { - id: baserect - property var enabledGradient: Gradient { - GradientStop {color: "#eee" ; position: 0} - GradientStop {color: control.pressed ? "#eee" : "#fff" ; position: 0.1} - GradientStop {color: "#fff" ; position: 1} - } - property var disabledGradient: Gradient { - GradientStop {color: "#999" ; position: 0} - GradientStop {color: __qgcPal.textField ; position: 0.1} - GradientStop {color: __qgcPal.textField ; position: 0.9} - GradientStop {color: "#999" ; position: 1} - } - gradient: control.enabled ? enabledGradient : disabledGradient - - - radius: ScreenTools.defaultFontPixelHeight * 0.16 - anchors.fill: parent - border.color: control.activeFocus ? "#47b" : "#999" - opacity: control.enabled ? 1 : 0.5 - } - - Image { - source: "/qmlimages/check.png" - opacity: control.checkedState === Qt.Checked ? control.enabled ? 1 : 0.5 : 0 - anchors.centerIn: parent - anchors.verticalCenterOffset: 1 - Behavior on opacity {NumberAnimation {duration: 80}} - } - - Rectangle { - anchors.fill: parent - anchors.margins: Math.round(baserect.radius) - antialiasing: true - gradient: Gradient { - GradientStop {color: control.pressed ? "#555" : "#999" ; position: 0} - GradientStop {color: "#555" ; position: 1} + anchors.fill: parent + radius: _radius + border.color: "black" + opacity: control.checkedState === Qt.PartiallyChecked ? 0.5 : 1 + + Rectangle { + anchors.margins: parent.height / 4 + anchors.fill: parent + radius: _radius + color: "black" + visible: control.checkedState === Qt.Checked } - radius: baserect.radius - 1 - anchors.centerIn: parent - anchors.alignWhenCentered: true - border.color: "#222" - Behavior on opacity {NumberAnimation {duration: 80}} - opacity: control.checkedState === Qt.PartiallyChecked ? control.enabled ? 1 : 0.5 : 0 } - } // indicator - } // style + } + } } diff --git a/src/QmlControls/QGCMouseArea.qml b/src/QmlControls/QGCMouseArea.qml index b58eb3498b2b518bf336cd559ebfb3e21017f383..e1a9f2c532ceddcec1b990212844d90bb58e28c1 100644 --- a/src/QmlControls/QGCMouseArea.qml +++ b/src/QmlControls/QGCMouseArea.qml @@ -1,4 +1,4 @@ -import QtQuick 2.3 +import QtQuick 2.11 import QGroundControl 1.0 import QGroundControl.ScreenTools 1.0 diff --git a/src/QmlControls/QGCRadioButton.qml b/src/QmlControls/QGCRadioButton.qml index e28d327e349a19888d2d12f3690048e77e90ce34..79792d386e99e27002a31f4806ddc9b391d36b3f 100644 --- a/src/QmlControls/QGCRadioButton.qml +++ b/src/QmlControls/QGCRadioButton.qml @@ -6,41 +6,30 @@ import QGroundControl.Palette 1.0 import QGroundControl.ScreenTools 1.0 RadioButton { - property var color: qgcPal.text ///< Text color - property int textStyle: Text.Normal - property color textStyleColor: qgcPal.text - property bool textBold: false - property var qgcPal: QGCPalette { colorGroupEnabled: enabled } + 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 / 2 + label: Item { - implicitWidth: text.implicitWidth + ScreenTools.defaultFontPixelWidth * 0.25 - implicitHeight: ScreenTools.implicitRadioButtonHeight + implicitWidth: _noText ? 0 : text.implicitWidth + ScreenTools.defaultFontPixelWidth * 0.25 + implicitHeight: _noText ? 0 : Math.max(text.implicitHeight, ScreenTools.radioButtonIndicatorSize) baselineOffset: text.y + text.baselineOffset - Rectangle { - anchors.fill: text - anchors.margins: -1 - anchors.leftMargin: -3 - anchors.rightMargin:-3 - visible: control.activeFocus - height: ScreenTools.defaultFontPixelWidth * 0.25 - radius: height * 0.5 - color: "#224f9fef" - border.color: "#47b" - opacity: 0.6 - } - Text { id: text text: control.text - font.pointSize: ScreenTools.defaultFontPointSize - font.family: ScreenTools.normalFontFamily + font.pointSize: textFontPointSize font.bold: control.textBold - antialiasing: true - color: control.color - style: control.textStyle - styleColor: control.textStyleColor + color: control.textColor anchors.centerIn: parent } } @@ -49,9 +38,9 @@ RadioButton { width: ScreenTools.radioButtonIndicatorSize height: width color: "white" - border.color: control.qgcPal.text - antialiasing: true + border.color: "black" radius: height / 2 + opacity: control.enabled ? 1 : 0.5 Rectangle { anchors.centerIn: parent @@ -60,7 +49,7 @@ RadioButton { antialiasing: true radius: height / 2 color: "black" - opacity: control.checked ? (control.enabled ? 1 : 0.5) : 0 + visible: control.checked } } } diff --git a/src/QmlControls/ToolStrip.qml b/src/QmlControls/ToolStrip.qml index 10d6eba22ac32d44b79c2861f8f5160ceacc7153..4ab074dec41af5aa55b7fbb1223924932477b427 100644 --- a/src/QmlControls/ToolStrip.qml +++ b/src/QmlControls/ToolStrip.qml @@ -7,8 +7,8 @@ * ****************************************************************************/ -import QtQuick 2.3 -import QtQuick.Controls 1.2 +import QtQuick 2.11 +import QtQuick.Controls 1.4 import QGroundControl.ScreenTools 1.0 import QGroundControl.Palette 1.0 @@ -17,7 +17,7 @@ Rectangle { id: _root color: qgcPal.window width: ScreenTools.isMobile ? ScreenTools.minTouchPixels : ScreenTools.defaultFontPixelWidth * 7 - height: buttonStripColumn.height + (buttonStripColumn.anchors.margins * 2) + height: toolStripColumn.height + (toolStripColumn.anchors.margins * 2) radius: _radius border.width: 1 border.color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(0,0,0,0.35) : Qt.rgba(1,1,1,0.35) @@ -35,9 +35,7 @@ Rectangle { readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2 readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2 - readonly property real _buttonSpacing: ScreenTools.defaultFontPixelWidth - - property bool _showOptionalElements: !ScreenTools.isTinyScreen + readonly property real _buttonSpacing: ScreenTools.defaultFontPixelHeight / 4 QGCPalette { id: qgcPal } ExclusiveGroup { id: dropButtonsExclusiveGroup } @@ -57,129 +55,141 @@ Rectangle { } Column { - id: buttonStripColumn + id: toolStripColumn anchors.margins: ScreenTools.defaultFontPixelWidth / 2 anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right + spacing: _buttonSpacing QGCLabel { anchors.horizontalCenter: parent.horizontalCenter text: title - visible: _showOptionalElements + font.pointSize: ScreenTools.smallFontPointSize } - Item { width: 1; height: _buttonSpacing; visible: _showOptionalElements } - Rectangle { anchors.left: parent.left anchors.right: parent.right height: 1 color: qgcPal.text - visible: _showOptionalElements } - Repeater { - id: repeater - - delegate: Column { - id: buttonColumn - width: buttonStripColumn.width - visible: _root.buttonVisible ? _root.buttonVisible[index] : true - - property bool checked: false - property ExclusiveGroup exclusiveGroup: dropButtonsExclusiveGroup - - QGCPalette { id: _repeaterPal; colorGroupEnabled: _buttonEnabled } - - property bool _buttonEnabled: _root.buttonEnabled ? _root.buttonEnabled[index] : true - property var _iconSource: modelData.iconSource - property var _alternateIconSource: modelData.alternateIconSource - property var _source: (_root.showAlternateIcon && _root.showAlternateIcon[index]) ? _alternateIconSource : _iconSource - property bool rotateImage: _root.rotateImage ? _root.rotateImage[index] : false - property bool animateImage: _root.animateImage ? _root.animateImage[index] : false - - onExclusiveGroupChanged: { - if (exclusiveGroup) { - exclusiveGroup.bindCheckable(buttonColumn) - } - } - - onRotateImageChanged: { - if (rotateImage) { - imageRotation.running = true - } else { - imageRotation.running = false - button.rotation = 0 - } - } - - onAnimateImageChanged: { - if (animateImage) { - opacityAnimation.running = true - } else { - opacityAnimation.running = false - button.opacity = 1 + Column { + anchors.left: parent.left + anchors.right: parent.right + spacing: _buttonSpacing + + Repeater { + id: repeater + + delegate: FocusScope { + id: scope + width: toolStripColumn.width + height: buttonRect.height + visible: _root.buttonVisible ? _root.buttonVisible[index] : true + + property bool checked: false + property ExclusiveGroup exclusiveGroup: dropButtonsExclusiveGroup + + property bool _buttonEnabled: _root.buttonEnabled ? _root.buttonEnabled[index] : true + property var _iconSource: modelData.iconSource + property var _alternateIconSource: modelData.alternateIconSource + property var _source: (_root.showAlternateIcon && _root.showAlternateIcon[index]) ? _alternateIconSource : _iconSource + property bool rotateImage: _root.rotateImage ? _root.rotateImage[index] : false + property bool animateImage: _root.animateImage ? _root.animateImage[index] : false + property bool _hovered: false + property bool _showHighlight: checked || (_buttonEnabled && _hovered) + + QGCPalette { id: _repeaterPal; colorGroupEnabled: _buttonEnabled } + + onExclusiveGroupChanged: { + if (exclusiveGroup) { + exclusiveGroup.bindCheckable(scope) + } } - } - Item { - width: 1 - height: _buttonSpacing - visible: index == 0 ? _showOptionalElements : true - } + onRotateImageChanged: { + if (rotateImage) { + imageRotation.running = true + } else { + imageRotation.running = false + buttonImage.rotation = 0 + } + } - FocusScope { - id: scope - anchors.left: parent.left - anchors.right: parent.right - height: width * 0.8 + onAnimateImageChanged: { + if (animateImage) { + opacityAnimation.running = true + } else { + opacityAnimation.running = false + buttonImage.opacity = 1 + } + } Rectangle { - anchors.fill: parent - color: checked ? _repeaterPal.buttonHighlight : _repeaterPal.button - - QGCColoredImage { - id: button - height: parent.height - width: height - anchors.centerIn: parent - source: _source - sourceSize.height: height - fillMode: Image.PreserveAspectFit - mipmap: true - smooth: true - color: checked ? _repeaterPal.buttonHighlightText : _repeaterPal.buttonText - - RotationAnimation on rotation { - id: imageRotation - loops: Animation.Infinite - from: 0 - to: 360 - duration: 500 - running: false + id: buttonRect + anchors.left: parent.left + anchors.right: parent.right + height: buttonColumn.height + color: _showHighlight ? _repeaterPal.buttonHighlight : _repeaterPal.window + + Column { + id: buttonColumn + anchors.left: parent.left + anchors.right: parent.right + spacing: -buttonImage.height / 8 + + QGCColoredImage { + id: buttonImage + anchors.left: parent.left + anchors.right: parent.right + height: width * 0.8 + //anchors.centerIn: parent + source: _source + sourceSize.height: height + fillMode: Image.PreserveAspectFit + mipmap: true + smooth: true + color: _showHighlight ? _repeaterPal.buttonHighlightText : _repeaterPal.text + + RotationAnimation on rotation { + id: imageRotation + loops: Animation.Infinite + from: 0 + to: 360 + duration: 500 + running: false + } + + NumberAnimation on opacity { + id: opacityAnimation + running: false + from: 0 + to: 1.0 + loops: Animation.Infinite + duration: 2000 + } } - NumberAnimation on opacity { - id: opacityAnimation - running: false - from: 0 - to: 1.0 - loops: Animation.Infinite - duration: 2000 + QGCLabel { + id: buttonLabel + anchors.horizontalCenter: parent.horizontalCenter + font.pointSize: ScreenTools.smallFontPointSize + text: modelData.name + color: _showHighlight ? _repeaterPal.buttonHighlightText : _repeaterPal.text + enabled: _buttonEnabled } - } + } // Column QGCMouseArea { - // Size of mouse area is expanded to make touch easier - anchors.leftMargin: -buttonStripColumn.anchors.margins - anchors.rightMargin: -buttonStripColumn.anchors.margins - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - height: parent.height + (_showOptionalElements? buttonLabel.height + buttonColumn.spacing : 0) - visible: _buttonEnabled - preventStealing: true + anchors.fill: parent + visible: _buttonEnabled + hoverEnabled: true + preventStealing: true + + onContainsMouseChanged: _hovered = containsMouse + onContainsPressChanged: _hovered = containsPress onClicked: { scope.focus = true @@ -205,23 +215,8 @@ Rectangle { } } } - } - } - - Item { - width: 1 - height: ScreenTools.defaultFontPixelHeight * 0.25 - visible: _showOptionalElements - } - - QGCLabel { - id: buttonLabel - anchors.horizontalCenter: parent.horizontalCenter - font.pointSize: ScreenTools.smallFontPointSize - text: modelData.name - visible: _showOptionalElements - enabled: _buttonEnabled - } + } // Rectangle + } // FocusScope } } }