From f35b2631ea06b3410a7d6a27c8088a0faf7b2183 Mon Sep 17 00:00:00 2001 From: Gus Grubba Date: Wed, 1 Jan 2020 18:23:06 -0500 Subject: [PATCH] Make charting on mobile official UI tweaks --- src/QGCApplication.cc | 4 ---- src/QGCApplication.h | 9 +-------- src/QmlControls/MAVLinkChart.qml | 10 +++------- src/QmlControls/MAVLinkMessageButton.qml | 12 ++++++------ 4 files changed, 10 insertions(+), 25 deletions(-) diff --git a/src/QGCApplication.cc b/src/QGCApplication.cc index 37536d019..cd7e05d09 100644 --- a/src/QGCApplication.cc +++ b/src/QGCApplication.cc @@ -157,11 +157,7 @@ static QObject* shapeFileHelperSingletonFactory(QQmlEngine*, QJSEngine*) } QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) - #if defined(__mobile__) - : QGuiApplication (argc, argv) - #else : QApplication (argc, argv) - #endif , _runningUnitTests (unitTesting) { _app = this; diff --git a/src/QGCApplication.h b/src/QGCApplication.h index 9bd19f75b..d4eb32e26 100644 --- a/src/QGCApplication.h +++ b/src/QGCApplication.h @@ -43,20 +43,13 @@ class QGCFileDownload; * * Needs QApplication base to support QtCharts module. This way * we avoid application crashing on 5.12 when using the module. - * We don't have QtWidgets on mobile, avoid using it. * * Note: `lastWindowClosed` will be sent by MessageBox popups and other * dialogs, that are spawned in QML, when they are closed **/ -class QGCApplication : - #if defined(__mobile__) - public QGuiApplication - #else - public QApplication - #endif +class QGCApplication : public QApplication { Q_OBJECT - public: QGCApplication(int &argc, char* argv[], bool unitTesting); ~QGCApplication(); diff --git a/src/QmlControls/MAVLinkChart.qml b/src/QmlControls/MAVLinkChart.qml index ec1ce94c1..b49e9f400 100644 --- a/src/QmlControls/MAVLinkChart.qml +++ b/src/QmlControls/MAVLinkChart.qml @@ -58,7 +58,7 @@ ChartView { tickCount: 5 gridVisible: true labelsFont.family: "Fixed" - labelsFont.pixelSize: ScreenTools.smallFontPointSize + labelsFont.pointSize: ScreenTools.smallFontPointSize } ValueAxis { @@ -68,7 +68,7 @@ ChartView { visible: chartController !== null lineVisible: false labelsFont.family: "Fixed" - labelsFont.pixelSize: ScreenTools.smallFontPointSize + labelsFont.pointSize: ScreenTools.smallFontPointSize } Row { @@ -88,7 +88,6 @@ ChartView { anchors.verticalCenter: parent.verticalCenter QGCLabel { text: qsTr("Scale:"); - font.pixelSize: ScreenTools.smallFontPointSize Layout.alignment: Qt.AlignVCenter } QGCComboBox { @@ -98,12 +97,10 @@ ChartView { model: controller.timeScales currentIndex: chartController ? chartController.rangeXIndex : 0 onActivated: { if(chartController) chartController.rangeXIndex = index; } - font.pixelSize: ScreenTools.smallFontPointSize Layout.alignment: Qt.AlignVCenter } QGCLabel { text: qsTr("Range:"); - font.pixelSize: ScreenTools.smallFontPointSize Layout.alignment: Qt.AlignVCenter } QGCComboBox { @@ -113,7 +110,6 @@ ChartView { model: controller.rangeList currentIndex: chartController ? chartController.rangeYIndex : 0 onActivated: { if(chartController) chartController.rangeYIndex = index; } - font.pixelSize: ScreenTools.smallFontPointSize Layout.alignment: Qt.AlignVCenter } } @@ -124,7 +120,7 @@ ChartView { QGCLabel { text: modelData.label color: chartView.series(index).color - font.pixelSize: ScreenTools.smallFontPointSize + font.pointSize: ScreenTools.smallFontPointSize } } } diff --git a/src/QmlControls/MAVLinkMessageButton.qml b/src/QmlControls/MAVLinkMessageButton.qml index 7026381dd..280a2489d 100644 --- a/src/QmlControls/MAVLinkMessageButton.qml +++ b/src/QmlControls/MAVLinkMessageButton.qml @@ -16,13 +16,12 @@ import QGroundControl.ScreenTools 1.0 Button { id: control - height: ScreenTools.defaultFontPixelHeight * 2 autoExclusive: true leftPadding: ScreenTools.defaultFontPixelWidth rightPadding: leftPadding - property real _compIDWidth: ScreenTools.defaultFontPixelWidth * 2.5 - property real _hzWidth: ScreenTools.defaultFontPixelWidth * 5 + property real _compIDWidth: ScreenTools.defaultFontPixelWidth * 3 + property real _hzWidth: ScreenTools.defaultFontPixelWidth * 6 property real _nameWidth: nameLabel.contentWidth background: Rectangle { @@ -40,22 +39,23 @@ Button { QGCLabel { text: control.compID color: checked ? qgcPal.buttonHighlightText : qgcPal.buttonText - font.pointSize: ScreenTools.smallFontPointSize + verticalAlignment: Text.AlignVCenter + Layout.minimumHeight: ScreenTools.isMobile ? (ScreenTools.defaultFontPixelHeight * 2) : (ScreenTools.defaultFontPixelHeight * 1.5) Layout.minimumWidth: _compIDWidth } QGCLabel { id: nameLabel text: control.text color: checked ? qgcPal.buttonHighlightText : qgcPal.buttonText - font.pointSize: ScreenTools.smallFontPointSize Layout.fillWidth: true + Layout.alignment: Qt.AlignVCenter } QGCLabel { color: checked ? qgcPal.buttonHighlightText : qgcPal.buttonText text: messageHz.toFixed(1) + 'Hz' - font.pointSize: ScreenTools.smallFontPointSize horizontalAlignment: Text.AlignRight Layout.minimumWidth: _hzWidth + Layout.alignment: Qt.AlignVCenter } } -- 2.22.0