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/QObject>
4#include <QtCore/QPointF>
5#include <QtCore/QString>
6#include <QtQmlIntegration/QtQmlIntegration>
7
8#include <limits>
9
12class QAbstractSeries;
13
14class QGCMAVLinkMessageField : public QObject
15{
16 Q_OBJECT
17 // QML_ELEMENT
18 Q_MOC_INCLUDE(<QtGraphs/QAbstractSeries>)
19 Q_PROPERTY(QString name READ name CONSTANT)
20 Q_PROPERTY(QString label READ label CONSTANT)
21 Q_PROPERTY(QString type READ type CONSTANT)
22 Q_PROPERTY(QString value READ value NOTIFY valueChanged)
23 Q_PROPERTY(bool selectable READ selectable NOTIFY selectableChanged)
24 Q_PROPERTY(int chartIndex READ chartIndex NOTIFY seriesChanged)
25 Q_PROPERTY(const QAbstractSeries *series READ series NOTIFY seriesChanged)
26
27public:
28 QGCMAVLinkMessageField(const QString &name, const QString &type, QGCMAVLinkMessage *parent = nullptr);
30
31 QString name() const { return _name; }
32 QString label() const;
33 QString type() const { return _type; }
34 QString value() const { return _value; }
35 bool selectable() const { return _selectable; }
36 bool selected() const { return !!_pSeries; }
37 const QAbstractSeries *series() const { return _pSeries; }
38 const QList<QPointF> *values() const { return &_values; }
39 qreal rangeMin() const { return _rangeMin; }
40 qreal rangeMax() const { return _rangeMax; }
41 int chartIndex() const;
42
43 void setSelectable(bool sel);
44 void updateValue(const QString &newValue, qreal v);
45 void resetBucketing(int bucketCount, qreal bucketWidthMs);
46
47 void addSeries(MAVLinkChartController *chartController, QAbstractSeries *series);
48 void delSeries();
49 void updateSeries();
50
51signals:
55
56private:
57 void _commitBucket();
58
59 QString _type;
60 QString _name;
61 QGCMAVLinkMessage *_msg = nullptr;
62
63 QString _value;
64 bool _selectable = true;
65 int _dataIndex = 0;
66 int _bucketCount = 0;
67 qreal _bucketWidthMs = 0;
68 qreal _currentBucketStart = -1;
69 qreal _currentBucketMin = 0;
70 qreal _currentBucketMax = 0;
71 qreal _rangeMin = std::numeric_limits<qreal>::max();
72 qreal _rangeMax = std::numeric_limits<qreal>::lowest();
73 QList<QPointF> _values;
74
75 QAbstractSeries *_pSeries = nullptr;
76 MAVLinkChartController *_chartController = nullptr;
77};
void updateValue(const QString &newValue, qreal v)
const QList< QPointF > * values() const
void addSeries(MAVLinkChartController *chartController, QAbstractSeries *series)
const QAbstractSeries * series() const
void resetBucketing(int bucketCount, qreal bucketWidthMs)