🐛 Fixed disabled buttons bug

main
Isabell Pflug 1 year ago
parent ecf2c9f555
commit 73a25cd618

@ -14,7 +14,7 @@ void MainWindow::clearConnected(std::set<std::vector<int>> *connected) {
qApp->processEvents();
usleep(550000);
for (auto i = connected->begin(); i != connected->end(); i++) {
buttonGrid[(*i)[0]][(*i)[1]]->setEnabled(false);
//buttonGrid[(*i)[0]][(*i)[1]]->setEnabled(false);
game->deleteCell((*i)[0], (*i)[1]);
}
refreshButtonGrid();
@ -38,9 +38,9 @@ void MainWindow::refreshButtonGrid() {
void MainWindow::bubbleUp(int row, int column) {
if (row > 0) {
QPushButton *tbutton = std::move(buttonGrid[row][column]);
/*QPushButton *tbutton = std::move(buttonGrid[row][column]);
buttonGrid[row][column] = std::move(buttonGrid[row-1][column]);
buttonGrid[row-1][column] = std::move(tbutton);
buttonGrid[row-1][column] = std::move(tbutton);*/
QString tcolor = game->getCell(row, column);
game->setCell(row, column, game->getCell(row-1, column));
@ -48,6 +48,7 @@ void MainWindow::bubbleUp(int row, int column) {
bubbleUp(row-1, column);
}
}
void MainWindow::bubbleBoxes(std::set<std::vector<int>> *connected) {
usleep(400000);
for (auto i = connected->begin(); i != connected->end(); i++) {
@ -58,11 +59,13 @@ void MainWindow::bubbleBoxes(std::set<std::vector<int>> *connected) {
// slots
void MainWindow::buttonPressed(int row, int column) {
if(game->getCell(row, column) != "") {
std::set<std::vector<int>> connected;
game->getConnected(&connected, game->getCell(row, column), row, column);
if ( connected.size() > 1) {
clearConnected(&connected);
bubbleBoxes(&connected);
}
} else
ui->statusBar->showMessage("Only friends get Stars!", 2000);
}
@ -139,6 +142,7 @@ MainWindow::MainWindow(QWidget *parent)
this->setPalette(pal);
ui->menuPlay->setPalette(pal);
ui->menuBar->setStyleSheet("QMenuBar::item {color: #a4133c}");
ui->statusBar->setStyleSheet("color: #a4133c");
refreshSizes();
game = new SameGame(rows, columns);
initialiseGame();

Loading…
Cancel
Save