Qt开发启动界面

 

#include "widget.h"
#include <QApplication>
#include <QSplashScreen>
#include <QPixmap>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    // Widget w;
    // w.show();
    
    // 使用图片做启动界面
    QPixmap pix(":/static/software_loading.png");
    pix = pix.scaled(540, 340);
    QSplashScreen splash(pix);
    splash.show();
    
    a.processEvents();  // 保证界面更新
    Widget w;
    splash.finish(&w);  // 等主窗口加载完成后显示主窗口
    w.show();
    
    
    return a.exec();
}

 

posted @ 2024-10-28 17:29  十一的杂文录  阅读(38)  评论(0)    收藏  举报