-
Notifications
You must be signed in to change notification settings - Fork 9
/
candle.h
42 lines (32 loc) · 957 Bytes
/
candle.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
#ifndef CANDLE_H
#define CANDLE_H
#include <QColor>
#include <QGraphicsItem>
#include "ohlc.h"
#include "graph_event_controller.h"
#include "axis_pair.h"
class Candle : public QGraphicsItem {
public:
// TODO: nebyl by lepsi decimal?
Candle(QDateTime start, QDateTime end, OHLC ohlc, AxisPair axisPair, GraphEventController* controller);
QRectF boundingRect() const;
QPainterPath shape() const;
private:
void paintHighLow(QPainter *painter);
void paintOpenClose(QPainter *painter);
QRectF getOpenCloseRect();
public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget);
private:
QDateTime start, end;
GraphEventController* controller;
void hoverEnterEvent(QGraphicsSceneHoverEvent* event);
void hoverLeaveEvent(QGraphicsSceneHoverEvent* event);
AxisPair axisPair;
OHLC ohlc;
public:
void setAxisPair(AxisPair axisPair);
float getWidth() const;
QDateTime getStart();
};
#endif