-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathminecell.h
54 lines (43 loc) · 1.07 KB
/
minecell.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
#ifndef MINECELL_H
#define MINECELL_H
#include <QPushButton>
#include <QRect>
#include <QWidget>
class MineCell : public QPushButton
{
Q_OBJECT
public:
MineCell(int size, QWidget *parent = nullptr);
void addNeighbour(MineCell *neighbour);
bool isBomb();
void setBomb();
bool isOpened();
void setOpened();
bool isMarked();
void setMarked();
void toggleMarked();
int getValue();
signals:
void hasExploded();
void hasOpened();
void rightClicked();
void checkWin();
void sigMarked(bool);
public slots:
void propagateOpen();
// void onClicked(bool marked);
protected:
virtual void paintEvent(QPaintEvent *event) override;
// virtual void mousePressEvent(QMouseEvent *event) override;
virtual void mouseReleaseEvent(QMouseEvent *event) override;
private:
QVector<MineCell *> neighbours;
QRectF cell;
bool rightClick;
// This is the model
int value;
bool bomb;
bool marked;
bool opened;
};
#endif // MINECELL_H