-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathXxwCustomPlot.h
More file actions
52 lines (44 loc) · 1.15 KB
/
XxwCustomPlot.h
File metadata and controls
52 lines (44 loc) · 1.15 KB
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
47
48
49
50
51
52
#ifndef XCUSTOMPLOT_H
#define XCUSTOMPLOT_H
#include "XxwTracer.h"
#include "qcustomplot.h"
#include <QObject>
#include <QList>
class XxwCustomPlot:public QCustomPlot
{
Q_OBJECT
public:
XxwCustomPlot(QWidget *parent = 0);
protected:
virtual void mouseMoveEvent(QMouseEvent *event);
public:
///
/// \brief 设置是否显示鼠标追踪器
/// \param show:是否显示
///
void showTracer(bool show)
{
m_isShowTracer = show;
if(m_xTracer)
m_xTracer->setVisible(m_isShowTracer);
foreach (XxwTracer *tracer, m_dataTracers)
{
if(tracer)
tracer->setVisible(m_isShowTracer);
}
if(m_lineTracer)
m_lineTracer->setVisible(m_isShowTracer);
}
///
/// \brief 是否显示鼠标追踪器
/// \return
///
bool isShowTracer(){return m_isShowTracer;};
private:
bool m_isShowTracer;//是否显示追踪器(鼠标在图中移动,显示对应的值)
XxwTracer *m_xTracer;//x轴
XxwTracer *m_yTracer;//y轴
QList<XxwTracer *> m_dataTracers;//
XxwTraceLine *m_lineTracer;//直线
};
#endif // XCUSTOMPLOT_H