-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathhashratecharview.cpp
59 lines (42 loc) · 1.17 KB
/
hashratecharview.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <QDateTimeAxis>
#include <QToolTip>
#include "hashratecharview.h"
hashrateCharView::hashrateCharView(QWidget *parent) :
QChartView(parent)
{
setRenderHint(QPainter::Antialiasing);
setMouseTracking(true);
setInteractive(true);
setRubberBand(RectangleRubberBand);
}
hashrateCharView::hashrateCharView(QChart *chart, QWidget *parent) :
QChartView(chart, parent)
{
setRenderHint(QPainter::Antialiasing);
//setMouseTracking(true);
//setInteractive(true);
setRubberBand(QChartView::NoRubberBand);
}
void hashrateCharView::setChart(QChart *chart)
{
QChartView::setChart(chart);
}
void hashrateCharView::mouseMoveEvent(QMouseEvent *event)
{
QPointF point = chart()->mapToValue(event->pos());
QDateTimeAxis *axisX = qobject_cast<QDateTimeAxis *>(chart()->axisX());
QToolTip::showText(event->globalPos(),
QString::number(point.y()),
this, rect() );
QChartView::mouseMoveEvent(event);
}
void hashrateCharView::wheelEvent(QWheelEvent *event)
{
if(event->angleDelta().y() > 0)
{
chart()->zoomIn();
}
else
chart()->zoomOut();
event->accept();
}