{
ui->setupUi(this);
+ statusLed = new QLed(ui->verticalLayoutWidget);
+ statusLed->setLayout(ui->horizontalLayout_4);
+ statusLed->setOnColor(QLed::Red);
+ statusLed->setOffColor(QLed::Green);
+ statusLed->setGeometry(QRect(0,0,100,100));
+ setCentralWidget(ui->verticalLayoutWidget);
connect(&tread,SIGNAL(generate(int)),this,SLOT(cliccaBottone(int)));
- connect(&tread,SIGNAL(score(int)),this,SLOT(sbagliato(int)));
+ connect(&tread,SIGNAL(score(int)),ui->lcdNumber,SLOT(display(int)));
+ connect(&tread,SIGNAL(exit(int)),this,SLOT(sbagliato(int)));
connect(&tread,SIGNAL(disableInterface()),this,SLOT(disableAll()));
connect(&tread,SIGNAL(enableInterface()),this,SLOT(enableAll()));
connect(this,SIGNAL(cliccatoIlBottone(int)),&tread,SLOT(updateCaption(int)));
tread.start();
- setStyleSheet("QPushButton {"
+ setStyleSheet("CrazyButton {"
"color: white;"
"background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #88d, stop: 0.1 #99e, stop: 0.49 #77c, stop: 0.5 #66b, stop: 1 #77c);"
"border-width: 1px;"
"font-size: 50px;"
"padding-left: 5px;"
"padding-right: 5px;"
- "min-width: 150px;"
- "max-width: 150px;"
- "min-height: 113px;"
- "max-height: 113px;"
+ "min-width: 15px;"
+ "max-width: 300px;"
+ "min-height: 11px;"
+ "max-height: 300px;"
"}"
"QPushButton:pressed {"
"padding-top: 15px;"
//showMaximized();
}
void MainWindow::sbagliato(int score){
- QString sscore("Score:");
+ QString sscore("Score ");
sscore.append(QString::number(score));
- QMessageBox::warning(this, tr("Sbagliato"),sscore,QMessageBox::Escape);
- tread.genera();
- //quick_exit(0);
+ QMessageBox::warning(this, tr("End Game"),sscore,QMessageBox::Escape);
+ //tread.genera();
+ exit(0);
}
void MainWindow::disableAll(){
ui->pushButton_7->setEnabled(false);
ui->pushButton_8->setEnabled(false);
ui->pushButton_9->setEnabled(false);
+ statusLed->setValue(true);
}
void MainWindow::enableAll(){
ui->pushButton_7->setEnabled(true);
ui->pushButton_8->setEnabled(true);
ui->pushButton_9->setEnabled(true);
+ statusLed->setValue(false);
}