{
ui->setupUi(this);
+ statusLed = new QLed(ui->verticalLayoutWidget);
+ ui->horizontalLayout_4->insertWidget(0,statusLed);
+
+ statusLed->setOnColor(QLed::Red);
+ statusLed->setOffColor(QLed::Green);
+ //statusLed->setGeometry(QRect(0,0,100,100));
+ statusLed->setShape(QLed::Rounded);
+ 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);
}
}
void MainWindow::clickA(){
emit cliccatoIlBottone(0);
- qDebug()<< "Click 1";
+
}
void MainWindow::clickB(){
emit cliccatoIlBottone(1);
- qDebug()<< "Click 2";
+
}
void MainWindow::clickC(){
emit cliccatoIlBottone(2);
- qDebug()<< "Click 3";
+
}
void MainWindow::clickD(){
emit cliccatoIlBottone(3);
- qDebug()<< "Click 4";
+
}
void MainWindow::clickE(){
emit cliccatoIlBottone(4);
- qDebug()<< "Click 5";
+
}
void MainWindow::clickF(){
emit cliccatoIlBottone(5);
- qDebug()<< "Click 6";
+
}
void MainWindow::clickG(){
emit cliccatoIlBottone(6);
- qDebug()<< "Click 7";
+
}
void MainWindow::clickH(){
emit cliccatoIlBottone(7);
- qDebug()<< "Click 8";
+
}
void MainWindow::clickI(){
emit cliccatoIlBottone(8);
- qDebug()<< "Click 9";
+
}