-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
59 lines (54 loc) · 1.96 KB
/
Copy pathmain.cpp
File metadata and controls
59 lines (54 loc) · 1.96 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
#include <QtGui/QApplication>
#include <QTextCodec>
#include <QFont>
#include "chessmainwindow.h"
#include "mysplashscreen.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
// QApplication::addLibraryPath("./plugins");
//使程序能支持中文显示和处理
QTextCodec::setCodecForLocale(QTextCodec::codecForName("GB2312"));
QTextCodec::setCodecForTr(QTextCodec::codecForName("GB2312"));
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("GB2312"));
//添加应用程序图标
QApplication::addLibraryPath("./images");
a.setWindowIcon(QIcon("./images/mychess.ico"));
// QTextCodec *gbk = QTextCodec::codecForName("gb18030");
// QTextCodec::setCodecForTr(gbk);
// QTextCodec::setCodecForLocale(gbk);
// QTextCodec::setCodecForCStrings(gbk);
//添加应用程序启动界面
// QSplashScreen *splash = new QSplashScreen;
// splash->setPixmap(QPixmap("./images/start.png"));
// splash->show();
// //让对话框延迟一段时间显示
// for(int i=0;i<2000;i++){
// splash->repaint();
// }
MySplashScreen *splash = new MySplashScreen(QPixmap("./images/start.png"));
splash->show(); // 显示
splash->setGeometry(128,72,800,576);
splash->move ((QApplication::desktop()->width() - splash->width())/2,
(QApplication::desktop()->height() - splash->height())/2);
splash->setProgress(30);// 显示%30
for(int i=0;i<60;i++){
splash->repaint();
}
splash->setProgress(60);
for(int i=0;i<60;i++){
splash->repaint();
}
splash->setProgress(90);
for(int i=0;i<60;i++){
splash->repaint();
}
//象棋主界面
ChessMainWindow w;
w.show();
//将窗口移动到屏幕的中央
w.move ((QApplication::desktop()->width() - w.width())/2,0);//(QApplication::desktop()->height() - w.height())/2);
splash->finish(&w); // 消失
delete splash;
return a.exec();
}