首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > QT开发 >

Qt程序起动画面QSplashScreen

2012-09-07 
Qt程序启动画面QSplashScreenQSplashScreen会在应用程序的主窗口出现之前显示一个图片!??#include qmain.

Qt程序启动画面QSplashScreen

QSplashScreen会在应用程序的主窗口出现之前显示一个图片!

?

?

#include "qmain.h"#include <QtGui/QApplication>#include <QSplashScreen>int main(int argc, char *argv[]){    QApplication app(argc, argv);    QPixmap pixmap(":/MyPicture/Resources/president.jpg");    QSplashScreen *splash = new QSplashScreen(pixmap);    splash->show();    //显示信息    splash->showMessage("Wait...");    Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop;    splash->showMessage(QObject::tr("Setting up the main window..."),topRight, Qt::white);//显示信息    qApp->processEvents();//This is used to accept a click on the screen so that user can cancel the screen    QMain window;    window.setStyleSheet("* { background-color:rgb(199,147,88); padding: 7px}");    window.show();    //图片一直显示到mainWin加载完成splash.finish(&window);    delete splash;    return app.exec();}

热点排行