-
Notifications
You must be signed in to change notification settings - Fork 0
/
table.h
156 lines (127 loc) · 2.92 KB
/
table.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
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#ifndef TABLE_H
#define TABLE_H
#include <QTableWidget>
#include <QOpenGLWidget>
#include "coordinate.h"
#include "shapes.h"
class Cell;
class Mask;
/**
* @brief The Table class is the main modifier widget for masks
*/
class Table : public QTableWidget
{
Q_OBJECT
public:
/**
* @brief Table constructor
* @param parent parent
* @param glParent widget we draw to
*/
Table(QWidget *parent, QOpenGLWidget *glParent);
~Table();
/**
* @brief render draw
*/
void render();
/**
* @brief render draw
* @param mousePos mouse position
*/
void render(Coordinate mousePos);
/**
* @brief removeRow override for removeRow()
* @param row row
*/
void removeRow(int row);
/**
* @brief addCoord add coordinate
* @param p new coordinate
*/
void addCoord(Coordinate c);
/**
* @brief setMaskType set the mask type
* @param type Polygon, Circle, Box
*/
void setMaskType(PolyEdit::Shape type);
/**
* @brief clearContents override for clearContents()
*/
void clearContents();
/**
* @brief getType returns shape type
* @return Polygon, Circle, Box
*/
PolyEdit::Shape getType() const;
/**
* @brief size returns number of vertecies
* @return number of vertecies
*/
std::size_t size() const;
/**
* @brief getRadius returns radius for circle shapes
* @return radius
*/
int getRadius() const;
/**
* @brief setRadius set the radius
* @param radius radius
*/
void setRadius(int radius);
/**
* @brief setBoxSize set the box size
* @param width width
* @param height height
*/
void setBoxSize(int width, int height);
/**
* @brief getcoordinate get coordinate
* @param i index
* @return coordinate
*/
const Coordinate getcoordinate(int i) const;
/**
* @brief scale set the scale
* @param factor factor
*/
void scale(double factor);
/**
* @brief exportSVG export SVG
* @param fpath file path
*/
void exportSVG(QString fpath);
/**
* @brief setRender enable drawing
* @param state true/false
*/
void setRender(bool state);
private slots:
/**
* @brief itemChanged cell selection changed
* @param item new cell
*/
void itemChanged(QTableWidgetItem *item);
private:
/**
* @brief getItem get a specific cell
* @param row row
* @param column column
* @return cell*
*/
Cell *getItem(int row, int column) const;
/**
* @brief insertRow override for insertRow()
* @param row row
*/
void insertRow(int row);
/**
* @brief keyPressEvent override for keypress
* @param event event
*/
void keyPressEvent(QKeyEvent *event);
Mask *mMask;
PolyEdit::Shape mType;
bool isReady;
bool mRender;
};
#endif // TABLE_H