-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrenderarea.h
74 lines (50 loc) · 1.3 KB
/
renderarea.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
#ifndef RENDERAREA_H
#define RENDERAREA_H
#include <QWidget>
#include <QPainter>
#include <QWheelEvent>
#include <QMouseEvent>
#include <QPainterPath>
#include <QLabel>
#include <QVector>
#include <defines.h>
#include <abstractfunction.h>
class RenderArea : public QWidget
{
Q_OBJECT
public:
explicit RenderArea(QWidget *parent = 0);
~RenderArea();
void move_up();
void move_right();
void move_down();
void move_left();
public slots :
inline void add_function(AbstractFunction* f) { ext_function.append(f); }
protected:
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE;
void mousePressEvent(QMouseEvent * ) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
private :
void drawAxes();
void drawFunction(AbstractFunction *f);
void calcCoord();
QPainter* pen;
QPoint center;
// ZOOM/DEZOOM
QPointF pix_unite;
QPointF unite;
QPointF base;
QPoint current_tab;
QPointF unite_per_pix;
// DEPLACEMENT
bool drag;
QPoint old_cursor;
QLabel* pos_label;
//STORAGE
QVector<AbstractFunction*> ext_function;
QVector<AbstractFunction*> intern_func;
};
#endif // RENDERAREA_H