-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
51 lines (40 loc) · 1.36 KB
/
Copy pathmain.cpp
File metadata and controls
51 lines (40 loc) · 1.36 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
#include "mainwindow.h"
#include <QApplication>
#include<QSplashScreen>
#include <QDateTime>
#include <iostream>
#include <string>
#include <cstdlib>
#include <sstream>
#include <cstring>
using namespace std;
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
//启动画面
QSplashScreen *splash = new QSplashScreen;
splash->setPixmap(QPixmap(":/images/World Map.jpg"));
splash->show();
app.processEvents();//这个函数告诉Qt去处理那些还没有被处理的各类事件,然后再把控制权返还给调用者。
Qt::Alignment topRight = Qt::AlignRight|Qt::AlignTop;
int m = MainWindow::num;
QString str = "Setting up main window...";
ostringstream oss;
oss << m ;
str = str+QString::fromStdString(oss.str());
const char * p = str.toLocal8Bit().data();
//splash->showMessage(QObject::tr("Setting up main window..."),topRight,Qt::blue);
splash->showMessage(QObject::tr(p),topRight,Qt::blue);
QDateTime n2=QDateTime::currentDateTime();
QDateTime now2;
do{
now2=QDateTime::currentDateTime();
} while (n2.secsTo(now2)<=5);//6为需要延时的秒数
MainWindow *mainWin = new MainWindow;
splash->showMessage(QObject::tr("Loading modules..."),topRight,Qt::white);
//loadm
mainWin->show();
splash->finish(mainWin);
delete splash;
return app.exec();
}