-
Notifications
You must be signed in to change notification settings - Fork 0
/
qcoolline.h
62 lines (47 loc) · 1.21 KB
/
qcoolline.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
#ifndef QCOOLLINE_H
#define QCOOLLINE_H
#include <QObject>
#include <QCoreApplication>
#include <QGraphicsProxyWidget>
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QDebug>
#include <QMouseEvent>
#include <QDateTime>
#include <QPushButton>
#include <QSpinBox>
#include <QLabel>
#include "leealgorythm.h"
enum mouse_event_state {
set_first_point = 0,
set_second_point,
delete_line
};
class QCoolLine : public QGraphicsView
{
Q_OBJECT
public:
QCoolLine();
~QCoolLine();
QGraphicsScene *scene;
private:
mouse_event_state mouse_es;
QPoint point1, point2;
QLine line;
QPushButton *btnuser;
QSpinBox *boxQuantity, *boxSize, *boardSizeX, *boardSizeY;
QLabel *boxQuantityLabel, *boxSizeLabel, *boardSizeXLabel, *boardSizeYLabel;
LeeAlgorythm *leeAlg;
QVector<QVector<int>> grid;
size_t sceneX_sz = 500;
size_t sceneY_sz = 500;
size_t box_quantity = 100;
size_t box_size = 30;
void setWidgets();
void sceneInit(const size_t &szX, const size_t &szY);
void setRects(const size_t &quantity, const size_t &box_size);
public slots:
void mousePressEvent(QMouseEvent *mouse_event);
void buttonPressHandle();
};
#endif // QCOOLLINE_H