-
Notifications
You must be signed in to change notification settings - Fork 0
/
buttonbox.cpp
35 lines (29 loc) · 994 Bytes
/
buttonbox.cpp
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
#include "buttonbox.h"
#include <QDebug>
ButtonBox::ButtonBox(QWidget *parent, int i, int j, QString player): QPushButton(parent), posX(i), posY(j), player(player), coord({i,j})
{
if (player == "1")
setStyleSheet("background-color: rgb(255, 0, 0);");
else if(player == "2")
setStyleSheet("background-color: rgb(0, 255, 0);");
else if(player == "3")
setStyleSheet("background-color: rgb(0, 0, 255);");
else if(player == "4")
setStyleSheet("background-color: rgb(140, 0, 255);");
else
setStyleSheet("background-color: rgb(132, 97, 8);");
setGeometry( posY*80+20*posY+20, posX*80+20*posX+20,80, 80);
this->show();
vector<char>charlist{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'};
move = charlist[posX];
move += to_string(posY + 1);
}
ButtonBox::~ButtonBox(){
}
void ButtonBox::pushButton_clicked(){
qDebug() << posX << posY;
emit buttonPressed(move);
}
Point ButtonBox::getCoord(){
return coord;
}