`
qimo601
  • 浏览: 3418387 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论

Qt程序启动画面QSplashScreen

    博客分类:
  • Qt
阅读更多

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();
}
0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics