-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCell.cpp
More file actions
109 lines (90 loc) · 1.73 KB
/
Copy pathCell.cpp
File metadata and controls
109 lines (90 loc) · 1.73 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
#include "Cell.h"
Cell::Cell(int posX, int posY, int val, bool fixed)
{
this->posX = posX;
this->posY = posY;
this->val = val;
this->fixed = fixed;
this->hints.reserve(9);
this->clicked = false;
for(int i = 0; i < 9; i++){
this->hints.push_back(false);
}
//domyślny "krzyż" na planszy
QColor background;
if( ( ( (posX - 1) / 3 ) & 1 ) == ( ( (posY - 1) / 3 ) & 1 ) )
background = QColor( Qt::white );
else
background = QColor( 225, 225, 225, 255 );
this->cellColor = background;
this->defCellColor = background;
this->defFontColor = QColor(Qt::black);
}
int Cell::getVal()
{
return this->val;
}
void Cell::setVal(int val)
{
if((val < 0) || (val > 9)) return;
this->val = val;
}
void Cell::addHint(int pos)
{
if((pos < 0) || pos > 8) return;
this->hints[pos] = true;
}
void Cell::removeHint(int pos)
{
if((pos < 0) || pos > 8) return;
this->hints[pos] = false;
}
bool Cell::isHint(int pos)
{
if((pos < 0) || pos > 8) return false;
return this->hints[pos];
}
bool Cell::getFixed()
{
return this->fixed;
}
void Cell::setClicked(bool clicked)
{
this->clicked = clicked;
}
bool Cell::getClicked()
{
return this->clicked;
}
int Cell::getRow()
{
return this->posX;
}
int Cell::getCol()
{
return this->posY;
}
QColor Cell::getCellColor()
{
return this->cellColor;
}
void Cell::setCellColor(QColor color)
{
this->cellColor = color;
}
void Cell::setDefColor()
{
this->cellColor = this->defCellColor;
}
QColor Cell::getFontColor()
{
return this->fontColor;
}
void Cell::setFontColor(QColor color)
{
this->fontColor = color;
}
void Cell::setDefFontColor()
{
this->fontColor = this->defFontColor;
}