-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.cpp
48 lines (41 loc) · 1.47 KB
/
mainwindow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->label->setTextFormat(Qt::RichText);
ui->label->setMargin(50);
CalThread* worker = new CalThread();
connect(worker, SIGNAL(finished()), worker, SLOT(deleteLater()));
connect(worker, &CalThread::FlashWhite, this, &MainWindow::FlashWhite, Qt::BlockingQueuedConnection);
connect(worker, &CalThread::ReturnBlack, this, &MainWindow::ReturnBlack, Qt::BlockingQueuedConnection);
connect(worker, SIGNAL(DisplayText(QString)), this, SLOT(DisplayText(QString)), Qt::BlockingQueuedConnection);
connect(worker, SIGNAL(progressBar_valueChanged(int)), this, SLOT(on_progressBar_valueChanged(int)), Qt::BlockingQueuedConnection);
worker->start();
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::FlashWhite()
{
this->setStyleSheet("background-color: white");
ui->label->setStyleSheet("color: black;");
}
void MainWindow::ReturnBlack()
{
this->setStyleSheet("background-color: black");
ui->label->setStyleSheet("color: white;");
ui->pushButton->setStyleSheet("QPushButton { background-color: light grey; }\n"
"QPushButton:enabled { background-color: light grey; }\n");
}
void MainWindow::DisplayText(QString text)
{
ui->label->setText(text);
}
void MainWindow::on_progressBar_valueChanged(int value)
{
ui->progressBar->setValue(value);
}