-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfirst.cpp
More file actions
67 lines (62 loc) · 1.7 KB
/
first.cpp
File metadata and controls
67 lines (62 loc) · 1.7 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include "first.h"
#include "ui_first.h"
First::First(QWidget *parent) :
QDialog(parent),
ui(new Ui::First)
{
ui->setupUi(this);
Qt::WindowFlags flags = this->windowFlags();
this->setWindowFlags(flags | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint);
this->setWindowFlags(Qt::WindowSystemMenuHint);
this->setWindowModality(Qt::ApplicationModal);
ui->pushButton->setEnabled(false);
QSettings* cfg = new QSettings("Config.ini", QSettings::IniFormat);
int first = cfg->value("Use/First").toInt();
cfg->sync();
if (first==0)
{
f1 = QtConcurrent::run(this,&First::timer);
}
}
First::~First()
{
delete ui;
}
void First::on_pushButton_clicked()
{
QSettings* cfg = new QSettings("Config.ini", QSettings::IniFormat);
cfg->setValue("Use/First", 1);
cfg->sync();
this->close();
}
void First::timer()
{
ui->pushButton->setText("10");
QThread::msleep(1000);
ui->pushButton->setText("9");
QThread::msleep(1000);
ui->pushButton->setText("8");
QThread::msleep(1000);
ui->pushButton->setText("7");
QThread::msleep(1000);
ui->pushButton->setText("6");
QThread::msleep(1000);
ui->pushButton->setText("5");
QThread::msleep(1000);
ui->pushButton->setText("4");
QThread::msleep(1000);
ui->pushButton->setText("3");
QThread::msleep(1000);
ui->pushButton->setText("2");
QThread::msleep(1000);
ui->pushButton->setText("1");
QThread::msleep(1000);
ui->pushButton->setEnabled(true);
ui->pushButton->setText("同意");
}
void First::on_pushButton_2_clicked()
{
f1.cancel();
this->close();
qApp->quit();
}