qt-18 程序启动画面

程序启动画面

screen.h

cpp 复制代码
#ifndef SCREEN_H
#define SCREEN_H

#include <QMainWindow>

class Screen : public QMainWindow
{
    Q_OBJECT

public:
    Screen(QWidget *parent = nullptr);
    ~Screen();
};
#endif // SCREEN_H

screen.cpp

cpp 复制代码
#include "screen.h"
#include <QTextEdit>
#include <windows.h>

Screen::Screen(QWidget *parent)
    : QMainWindow(parent)
{
    setWindowTitle(tr("Splash Example"));
    QTextEdit* Edit = new QTextEdit(tr("Splash Example"));
    setCentralWidget(Edit);
    resize(600,450);
    Sleep(3000);

}

Screen::~Screen() {}

main.cpp

cpp 复制代码
#include "screen.h"

#include <QApplication>
#include <QPixmap>
#include <QSplashScreen>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QPixmap PixMap("text.png");
    QSplashScreen Splash(PixMap);
    Splash.show();
    a.processEvents();//展示画面 界面  然可以响应鼠标等操作
    Screen w;
    w.show();
    Splash.finish(&w);
    return a.exec();
}

运行图

启动图片

启动后程序

相关推荐
ace望世界4 小时前
android的Parcelable
android
顾林海4 小时前
Android编译插桩之AspectJ:让代码像特工一样悄悄干活
android·面试·性能优化
叽哥4 小时前
Flutter Riverpod上手指南
android·flutter·ios
循环不息优化不止4 小时前
安卓开发设计模式全解析
android
诺诺Okami4 小时前
Android Framework-WMS-层级结构树
android
Raymond运维4 小时前
MariaDB源码编译安装(二)
运维·数据库·mariadb
沢田纲吉4 小时前
🗄️ MySQL 表操作全面指南
数据库·后端·mysql
alexhilton15 小时前
面向开发者的系统设计:像建筑师一样思考
android·kotlin·android jetpack
RestCloud20 小时前
SQL Server到Hive:批处理ETL性能提升30%的实战经验
数据库·api
RestCloud20 小时前
为什么说零代码 ETL 是未来趋势?
数据库·api