Well,no I still get the bug...
The code is:
void TicTacToe
::btnChangeX(QPushButton * x
) //this function is run on every pressed button {
x
->setIcon
(QIcon("ex.png"));
x
->setIconSize
(QSize(64,
64));
x->disconnect();
x->setProperty("x",false); //here is set it to x,false
lbl->setText("<b>Turn : Player 2</b>");
turn = false;
}
bool TicTacToe::winX() //this function is called to every btn as well and checks for winner
{
if(btn[0]->property("x").toBool() && btn[1]->property("x").toBool() && btn[2]->property("x").toBool())
{
btn[0]->setText("x won 1"); //here is the bug,although i did click only btn[0],the winner text has appeared....
for(i; i < 9; i++)
btn[i]->disconnect();
return true;
}
void TicTacToe::btnChangeX(QPushButton * x) //this function is run on every pressed button
{
x->setIcon(QIcon("ex.png"));
x->setIconSize(QSize(64,64));
x->disconnect();
x->setProperty("x",false); //here is set it to x,false
lbl->setText("<b>Turn : Player 2</b>");
turn = false;
}
bool TicTacToe::winX() //this function is called to every btn as well and checks for winner
{
if(btn[0]->property("x").toBool() && btn[1]->property("x").toBool() && btn[2]->property("x").toBool())
{
btn[0]->setText("x won 1"); //here is the bug,although i did click only btn[0],the winner text has appeared....
for(i; i < 9; i++)
btn[i]->disconnect();
return true;
}
To copy to clipboard, switch view to plain text mode
Bookmarks