-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
44 lines (33 loc) · 985 Bytes
/
Copy pathmain.cpp
File metadata and controls
44 lines (33 loc) · 985 Bytes
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
#include "mainwindow.h"
#include <QApplication>
#include "connection.h"
#include "tipsdialog.h"
#include <QMessageBox>
// 加载QSS样式
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QFile file(":/black.qss");
if( file.open(QFile::ReadOnly))
{
QString styleSheet = QLatin1String(file.readAll());
a.setStyleSheet(styleSheet);
file.close();
}
else
{
QMessageBox::warning(NULL, "warning", "Open failed", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
}
if(!createConnection())
return 1;
TipsDialog dlg;
MainWindow w;
if(dlg.exec() == QDialog::Accepted) // 利用Accepted返回值判断按钮是否被按下
{
w.show(); // 如果被按下,显示主窗口
return a.exec(); // 程序一直执行,直到主窗口关闭
}
else return 0;
//w.show();
return a.exec();
}