-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathqwtquick2.h
46 lines (32 loc) · 998 Bytes
/
qwtquick2.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef QMLPLOT_H
#define QMLPLOT_H
#include <QtQuick>
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
class QwtQuick2Plot : public QQuickPaintedItem
{
Q_OBJECT
public:
QwtQuick2Plot(QQuickItem* parent = nullptr);
virtual ~QwtQuick2Plot();
void paint(QPainter* painter);
Q_INVOKABLE void initQwtPlot();
protected:
void routeMouseEvents(QMouseEvent* event);
void routeWheelEvents(QWheelEvent* event);
virtual void mousePressEvent(QMouseEvent* event);
virtual void mouseReleaseEvent(QMouseEvent* event);
virtual void mouseMoveEvent(QMouseEvent* event);
virtual void mouseDoubleClickEvent(QMouseEvent* event);
virtual void wheelEvent(QWheelEvent *event);
virtual void timerEvent(QTimerEvent *event);
private:
QwtPlot* m_qwtPlot;
QwtPlotCurve* m_curve1;
QVector<QPointF> m_curve1_data;
int m_timerId;
void replotAndUpdate();
private slots:
void updatePlotSize();
};
#endif // QMLPLOT_H