QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
MAVLinkMessageField.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QLoggingCategory>
4#include <QtCore/QObject>
5#include <QtCore/QPointF>
6#include <QtCore/QString>
7#include <QtQmlIntegration/QtQmlIntegration>
8
9Q_DECLARE_LOGGING_CATEGORY(MAVLinkMessageFieldLog)
10
13class QAbstractSeries;
14
15class QGCMAVLinkMessageField : public QObject
16{
17 Q_OBJECT
18 // QML_ELEMENT
19 Q_MOC_INCLUDE(<QtCharts/QAbstractSeries>)
20 Q_PROPERTY(QString name READ name CONSTANT)
21 Q_PROPERTY(QString label READ label CONSTANT)
22 Q_PROPERTY(QString type READ type CONSTANT)
23 Q_PROPERTY(QString value READ value NOTIFY valueChanged)
24 Q_PROPERTY(bool selectable READ selectable NOTIFY selectableChanged)
25 Q_PROPERTY(int chartIndex READ chartIndex CONSTANT)
26 Q_PROPERTY(const QAbstractSeries *series READ series NOTIFY seriesChanged)
27
28public:
29 QGCMAVLinkMessageField(const QString &name, const QString &type, QGCMAVLinkMessage *parent = nullptr);
31
32 QString name() const { return _name; }
33 QString label() const;
34 QString type() const { return _type; }
35 QString value() const { return _value; }
36 bool selectable() const { return _selectable; }
37 bool selected() const { return !!_pSeries; }
38 const QAbstractSeries *series() const { return _pSeries; }
39 const QList<QPointF> *values() const { return &_values; }
40 qreal rangeMin() const { return _rangeMin; }
41 qreal rangeMax() const { return _rangeMax; }
42 int chartIndex() const;
43
44 void setSelectable(bool sel);
45 void updateValue(const QString &newValue, qreal v);
46
47 void addSeries(MAVLinkChartController *chartController, QAbstractSeries *series);
48 void delSeries();
49 void updateSeries();
50
51signals:
55
56private:
57 QString _type;
58 QString _name;
59 QGCMAVLinkMessage *_msg = nullptr;
60
61 QString _value;
62 bool _selectable = true;
63 int _dataIndex = 0;
64 qreal _rangeMin = 0;
65 qreal _rangeMax = 0;
66 QList<QPointF> _values;
67
68 QAbstractSeries *_pSeries = nullptr;
69 MAVLinkChartController *_chartController = nullptr;
70};
Q_DECLARE_LOGGING_CATEGORY(AndroidSerialLog)