QTCreator-android 引導頁添加

1、main函數修改

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

#include <QSplashScreen>
#include<QScreen>
#include "utils.h"

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    app.setApplicationName("Guide");
    app.setOrganizationName("GDPURJYFS");
    app.setOrganizationDomain("github.com/GDPURJYFS");
    app.setApplicationVersion("0.1.2");

    QPixmap pixmap(":/SplashScreen/1");

    QScreen *screen=QGuiApplication::primaryScreen ();
    QRect mm=screen->availableGeometry() ;
    int screen_width = mm.width();
    int screen_height = mm.height();

    pixmap = pixmap.scaled(screen_width,screen_height);

    QSplashScreen splash(pixmap);
    splash.show();
    app.processEvents();                 //使程序在顯示啓動畫面的同時仍能響應鼠標等其他事件

    Utils::qWait(6000);

    Widget w;
    w.show();

    splash.finish(&w);

    return app.exec();
}

2、添加圖片資源

 

圖片需要拷貝到項目目錄

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章