mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-05 16:46:06 +01:00
64 lines
1.1 KiB
C++
64 lines
1.1 KiB
C++
#ifndef MONITORWIDGET_H
|
|
#define MONITORWIDGET_H
|
|
|
|
#include <QWidget>
|
|
#include <QObject>
|
|
#include <QGraphicsView>
|
|
#include <QtSvg/QSvgRenderer>
|
|
#include <QtSvg/QGraphicsSvgItem>
|
|
#include <QtCore/QPointer>
|
|
|
|
class MonitorWidget : public QGraphicsView {
|
|
Q_OBJECT
|
|
public:
|
|
explicit MonitorWidget(QWidget *parent = 0);
|
|
~MonitorWidget();
|
|
|
|
void setMin(double min)
|
|
{
|
|
minValue = min;
|
|
}
|
|
|
|
double getMin()
|
|
{
|
|
return minValue;
|
|
}
|
|
|
|
void setMax(double max)
|
|
{
|
|
maxValue = max;
|
|
}
|
|
|
|
double getMax()
|
|
{
|
|
return maxValue;
|
|
}
|
|
|
|
public slots:
|
|
void telemetryConnected();
|
|
void telemetryDisconnected();
|
|
void telemetryUpdated(double txRate, double rxRate);
|
|
|
|
protected:
|
|
void showEvent(QShowEvent *event);
|
|
void resizeEvent(QResizeEvent *event);
|
|
|
|
private:
|
|
bool connected;
|
|
|
|
double minValue;
|
|
double maxValue;
|
|
|
|
QGraphicsSvgItem *graph;
|
|
|
|
QPointer<QGraphicsTextItem> txSpeed;
|
|
QPointer<QGraphicsTextItem> rxSpeed;
|
|
|
|
QList<QGraphicsSvgItem *> txNodes;
|
|
QList<QGraphicsSvgItem *> rxNodes;
|
|
|
|
Qt::AspectRatioMode aspectRatioMode;
|
|
};
|
|
|
|
#endif // MONITORWIDGET_H
|