cooler UI + status bar color + custom message for user welcome
This commit is contained in:
parent
7f4d9038ef
commit
ca56538821
|
@ -26,14 +26,23 @@ MainWindow::MainWindow(QWidget* parent)
|
|||
qDebug() << "Pulisco db";
|
||||
sqliteInterface.cleanup();
|
||||
|
||||
connect(&lineTessera_timer, &QTimer::timeout, this,
|
||||
&MainWindow::on_lineTessera_timer_timeout);
|
||||
connect(&lineTessera_timer, &QTimer::timeout,
|
||||
this, &MainWindow::on_lineTessera_timer_timeout);
|
||||
|
||||
connect(ui->statusbar, &QStatusBar::messageChanged,
|
||||
this, &MainWindow::on_statusbar_changed);
|
||||
|
||||
int registrati = sqliteInterface.count();
|
||||
ui->lineRegistrati->setText(QString::number(registrati));
|
||||
ui->statusbar->showMessage("Passare tessera magnetica", 0);
|
||||
}
|
||||
|
||||
void MainWindow::on_statusbar_changed() {
|
||||
if ((ui->statusbar->currentMessage()).length() == 0) {
|
||||
ui->statusbar->setStyleSheet("background-color: auto;");
|
||||
}
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() {}
|
||||
|
||||
void MainWindow::on_actionAbout_triggered() {
|
||||
|
@ -55,6 +64,7 @@ void MainWindow::on_lineTessera_timer_timeout() {
|
|||
addVisitor(codfis, anagrafica);
|
||||
} else {
|
||||
ui->statusbar->showMessage("Tessera non valida, riprovare!", MESSAGE_TIMEOUT);
|
||||
ui->statusbar->setStyleSheet("background-color: red;");
|
||||
}
|
||||
|
||||
ui->lineTessera->setText("");
|
||||
|
@ -83,6 +93,8 @@ void MainWindow::addVisitor(QString& codfis, QString& anagrafica) {
|
|||
registrati++;
|
||||
ui->lineRegistrati->setText(QString::number(registrati));
|
||||
ui->statusbar->showMessage("Inserimento effettuato correttamente!", MESSAGE_TIMEOUT);
|
||||
ui->statusbar->setStyleSheet("background-color: green;");
|
||||
ui->labelNome->setText(QString("Ciao %1!").arg(anagrafica));
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent* event) {
|
||||
|
|
|
@ -33,6 +33,7 @@ class MainWindow : public QMainWindow {
|
|||
void on_actionAbout_triggered();
|
||||
void on_lineTessera_textEdited(const QString& text);
|
||||
void on_lineTessera_timer_timeout();
|
||||
void on_statusbar_changed();
|
||||
|
||||
private:
|
||||
Ui::MainWindow* ui;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<x>6</x>
|
||||
<y>6</y>
|
||||
<width>781</width>
|
||||
<height>188</height>
|
||||
<height>228</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
|
@ -59,6 +59,21 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelNome">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>24</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ciao!</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
|
|
Loading…
Reference in New Issue