-
Notifications
You must be signed in to change notification settings - Fork 7
/
paintscene.h
68 lines (53 loc) · 1.42 KB
/
paintscene.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
#ifndef PAINTSCENE_H
#define PAINTSCENE_H
#include <QGraphicsScene>
#include <QGraphicsSceneMouseEvent>
#include <QUndoStack>
#include <QGraphicsView>
#include <QTableWidget>
#include "figure.h"
class PaintScene : public QGraphicsScene
{
Q_OBJECT
Q_PROPERTY(int typeFigure
READ typeFigure WRITE setTypeFigure
NOTIFY typeFigureChanged)
public:
QGraphicsView* view;
QPointF startPoint;
QPointF EndPoint;
QVector<Figure*> *ItemsVec;
QVector<Figure*> *SavedVec;
QTableWidget* table;
QUndoStack *undoStack;
explicit PaintScene(QGraphicsView *view,QTableWidget* table, QObject *parent = 0);
~PaintScene();
QString defaultPath = "";
void setFillColor(QColor color);
int typeFigure() const;
void setTypeFigure(const int type);
bool Modified = false;
enum FigureTypes {
RectangleType,
CircleType,
TriangleType,
LineType,
EraserType
};
void setColor(QColor color);
void setWeight(int Value);
signals:
void typeFigureChanged();
private:
Figure *tempFigure;
private:
void mousePressEvent(QGraphicsSceneMouseEvent * event);
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
QColor paintingColor;
int LineWeight;
int m_typeFigure;
bool selectingItem;
QColor fillColor = Qt::white;
};
#endif // PAINTSCENE_H