-
Notifications
You must be signed in to change notification settings - Fork 9
/
abstract_graph_view.h
49 lines (37 loc) · 1.1 KB
/
abstract_graph_view.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
#ifndef ABSTRACT_GRAPH_VIEW_H_INCLUDED
#define ABSTRACT_GRAPH_VIEW_H_INCLUDED
#include <QGraphicsView>
#include "time_axis.h"
#include "number_axis.h"
class GraphViewport;
class GraphOverlay;
class AbstractGraphView: public QGraphicsView {
Q_OBJECT
public:
AbstractGraphView();
QGraphicsScene* getScene();
public slots:
void redraw();
protected:
QList<GraphOverlay*> overlays;
QGraphicsScene *scene;
protected:
virtual GraphViewport* viewport() = 0;
virtual void internalizeViewport(GraphViewport* viewport) = 0;
virtual void addOverlays() = 0;
virtual TimeAxis timeAxis(); // Def. impl.
virtual NumberAxis numberAxis(); // Def. impl.: use ranges from viewport (implicit)
public slots:
void notifyOverlaysProjectionChanged();
virtual void notifyOverlaysRangesChanged();
void assignViewport(GraphViewport* viewport);
protected:
void mouseMoveEvent(QMouseEvent *);
void wheelEvent(QWheelEvent *);
void resizeEvent(QResizeEvent *);
signals:
void resized();
void dataPointHovered(QDateTime time, float price);
void dataPointZoomed(QDateTime time, int delta);
};
#endif