-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyqchartview.cpp
43 lines (38 loc) · 956 Bytes
/
myqchartview.cpp
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
#include "myqchartview.h"
#include <QDebug>
myqchartview::myqchartview(QWidget *parent):QChartView(parent)
{
painter = new QPainter(this);
}
myqchartview::myqchartview(QChart *chart, QWidget *parent):QChartView(chart,parent)
{
painter = new QPainter(this);
}
myqchartview::~myqchartview()
{
}
void myqchartview::mouseMoveEvent(QMouseEvent *event)
{
if(event->buttons() & Qt::RightButton)
{
QPoint errorPose = event->pos()-StartPos;
StartPos=event->pos();
emit chart_move(errorPose);
}
QChartView::mouseMoveEvent(event);
}
void myqchartview::mousePressEvent(QMouseEvent *event)
{
if(event->button() == Qt::RightButton)
{
StartPos = event->pos();
}
QChartView::mousePressEvent(event);
}
void myqchartview::wheelEvent(QWheelEvent *event)
{
qreal delta = event->angleDelta().y();
QPoint pos = event->pos();
emit zoom_moev(delta,pos);
QChartView::wheelEvent(event);
}