-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathabstractscheme.h
More file actions
executable file
·119 lines (102 loc) · 2.44 KB
/
Copy pathabstractscheme.h
File metadata and controls
executable file
·119 lines (102 loc) · 2.44 KB
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#ifndef ABSTRACTSCHEME_H
#define ABSTRACTSCHEME_H
#include <QGraphicsScene>
#include "component.h"
#include <QVarLengthArray>
#include <QMouseEvent>
#include <QPainter>
#include "graphicscomponent.h"
#include "applicationutils.h"
#include "componentcommand.h"
#include <QStyle>
class GraphicsComponent;
enum AlignmentType{
Left, Right, Top, Bottom
};
enum RotationDirection{
RotateLeft, RotateRight
};
//! Abstract class that implements common features for all schemes
/**
Abstract class that implements common features for all schemes - grid drawing,
snapping and so on.
*/
class AbstractScheme: public QGraphicsScene
{
Q_OBJECT
private:
/**
* Indicates that snapping is enabled
*/
bool snapToGrid;
/**
* Controls visibility of a grid
*/
bool gridVisible;
/**
* Step of the grid
*/
int gridStep;
/**
* Color of the grid
*/
QColor gridColor;
public:
/**
* Default constructor
*/
AbstractScheme();
/**
* Constructs scheme with specified parent
* @param parent parent component
*/
AbstractScheme(QObject *parent);
/**
* Enables or disables grid snapping
* @param enabled state of the grid snapping
*/
void setSnapToGrid(bool enabled);
/**
* Returns state of snapping mode
* @return state of the snapping mode
*/
bool getSnapToGrid();
/**
* Sets step of the grid
* @param value value of the step
*/
void setGridStep(int vaue);
/**
* Returns size of the grid step
* @return grid step size
*/
int getGridStep();
/**
* Sets color of the grid
* color color of the grid
*/
void setGridColor(QColor color);
/**
* Returns color of the grid
* @return grid color
*/
QColor getGridColor();
/**
* Enables or disables grid
* @param show grid visibility
*/
void showGrid(bool show);
/**
* Rotates selected components
* @param direction RotationDirection
*/
void rotateSelected(RotationDirection direction);
/**
* @param alignment alignment type
*/
void alignSelected(AlignmentType alignment);
virtual void drawBackground( QPainter * painter, const QRectF & rect );
public slots:
signals:
};
#endif // ABSTRACTSCHEME_H