forked from cetcjinjian/StockKLine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathklinegrid.h
101 lines (65 loc) · 1.7 KB
/
klinegrid.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#ifndef KLINEGRID_H
#define KLINEGRID_H
#include "autogrid.h"
#include "datafile.h"
#include <QPoint>
#include "showdetail.h"
#include <QString>
class ShowDetail;
class KLineGrid : public AutoGrid
{
Q_OBJECT
public:
explicit KLineGrid(QWidget *parent = 0);
void virtual paintEvent(QPaintEvent* event);
void virtual keyPressEvent(QKeyEvent* event);
void virtual mouseMoveEvent(QMouseEvent* event);
void virtual mousePressEvent(QMouseEvent* event);
void virtual resizeEvent(QResizeEvent* event);
~KLineGrid();
bool readData(QString strFile);
void initial();
void drawLine();
void getIndicator();
void drawYtick();
void drawKline();
//键盘按下后画的十字线
void drawCross();
void drawCrossVerLine();
void drawCrossHorLine();
void drawTips();
//键盘没按下画的十字线
void drawCross2();
void drawMouseMoveCrossVerLine();
void drawMouseMoveCrossHorLine();
void drawTips2();
//画均线
void drawAverageLine(int day);
private:
DataFile mDataFile;
ShowDetail* mShowDrtail;
//画k线的起始日期和终止日期
int beginDay;
int endDay;
int totalDay;
int currentDay;
//当前要画的k线日期中的最高价,最低价,最大成交量
double highestBid;
double lowestBid;
double maxVolume;
//x轴和y轴的缩放比
double xscale;
double yscale;
//是否显示十字线
bool bCross = false;
//鼠标位置
QPoint mousePoint;
//画笔的线宽
int lineWidth;
//键盘是否按下
bool isKeyDown = false;
//是否画均线
bool isDrawAverageLine = true;
signals:
};
#endif // KLINEGRID_H