Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- connect(ui->comboBox, SIGNAL(currentIndexChanged(const int &)), this, SLOT (qwerty(const int &)));
- connect(ui->pushButton, SIGNAL(clicked()), this, SLOT (print_button()));
- connect(ui->pushButton_3, SIGNAL(clicked()), this, SLOT (print_button()));
- connect(ui->pushButton_4, SIGNAL(clicked()), this, SLOT (print_button()));
- connect(ui->pushButton_5, SIGNAL(clicked()), this, SLOT (print_button()));
- connect(ui->pushButton_6, SIGNAL(clicked()), this, SLOT (print_button()));
- connect(ui->pushButton_7, SIGNAL(clicked()), this, SLOT (print_button()));
- connect(ui->pushButton_8, SIGNAL(clicked()), this, SLOT (print_button()));
- connect(ui->pushButton_9, SIGNAL(clicked()), this, SLOT (print_button()));
- connect(ui->pushButton_10, SIGNAL(clicked()), this, SLOT (print_button()));
- void MainWindow::print_button()
- {
- QPushButton *button = (QPushButton *)sender();
- if(button->text() != "X" && button->text() != "O")
- {
- int number_button = button->text().toInt();
- if(count % 2 == 0)
- {
- button->setText("X");
- button->setStyleSheet("QPushButton{background:rgb(255, 255, 255);color: red}");
- QFont f = ui->pushButton->font(); //QFont определяет шрифт, используемый для рисования текста//Font() берет шрифт кнопки
- f.setPointSize(100); //Устанавливает шрифт
- f.setBold(true); //делает жирным (Принимает bool да/нет)
- button->setFont(f);// устанавливает шрифт по переменной f
- }
- else
- {
- button->setText("O");
- button->setStyleSheet("QPushButton {background:rgb(255, 255, 255);color: blue}");
- QFont f = button->font(); //QFont определяет шрифт, используемый для рисования текста//Font() берет шрифт кнопки
- f.setPointSize(100); //Устанавливает шрифт
- f.setBold(true); //делает жирным (Принимает bool да/нет)
- button->setFont(f);// устанавливает шрифт по переменной f
- }
- count++;
- switch (number_button)
- {
- case 1: game.arr[0][0] = button->text(); break;
- case 2: game.arr[0][1] = button->text(); break;
- case 3: game.arr[0][2] = button->text(); break;
- case 4: game.arr[1][0] = button->text(); break;
- case 5: game.arr[1][1] = button->text(); break;
- case 6: game.arr[1][2] = button->text(); break;
- case 7: game.arr[2][0] = button->text(); break;
- case 8: game.arr[2][1] = button->text(); break;
- case 9: game.arr[2][2] = button->text(); break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement