Browse Source

Make charting on mobile official

UI tweaks
QGC4.4
Gus Grubba 5 years ago committed by Lorenz Meier
parent
commit
f35b2631ea
  1. 4
      src/QGCApplication.cc
  2. 9
      src/QGCApplication.h
  3. 10
      src/QmlControls/MAVLinkChart.qml
  4. 12
      src/QmlControls/MAVLinkMessageButton.qml

4
src/QGCApplication.cc

@ -157,11 +157,7 @@ static QObject* shapeFileHelperSingletonFactory(QQmlEngine*, QJSEngine*) @@ -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;

9
src/QGCApplication.h

@ -43,20 +43,13 @@ class QGCFileDownload; @@ -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();

10
src/QmlControls/MAVLinkChart.qml

@ -58,7 +58,7 @@ ChartView { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -124,7 +120,7 @@ ChartView {
QGCLabel {
text: modelData.label
color: chartView.series(index).color
font.pixelSize: ScreenTools.smallFontPointSize
font.pointSize: ScreenTools.smallFontPointSize
}
}
}

12
src/QmlControls/MAVLinkMessageButton.qml

@ -16,13 +16,12 @@ import QGroundControl.ScreenTools 1.0 @@ -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 { @@ -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
}
}

Loading…
Cancel
Save