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();
}

运行图

启动图片

启动后程序

相关推荐
小满、19 小时前
MySQL :存储引擎原理、索引结构与执行计划
数据库·mysql·索引·mysql 存储引擎
x***133919 小时前
SQL Server 创建用户并授权
数据库·oracle
JIngJaneIL19 小时前
智慧物业|物业管理|基于SprinBoot+vue的智慧物业管理系统(源码+数据库+文档)
java·前端·数据库·vue.js·spring boot·论文·智慧物业管理系统
枫叶梨花19 小时前
一次 Kettle 中文乱码写入失败的完整排查实录
数据库·后端
顾林海19 小时前
从0到1搭建Android网络框架:别再让你的请求在"路上迷路"了
android·面试·架构
花花鱼20 小时前
android room中实体类变化以后如何迁移
android
笃行客从不躺平20 小时前
遇到大SQL怎么处理
java·开发语言·数据库·sql
Jomurphys20 小时前
设计模式 - 适配器模式 Adapter Pattern
android
雨白20 小时前
电子书阅读器:解析 EPUB 底层原理与实战
android·html
g***B73820 小时前
Kotlin协程在Android中的使用
android·开发语言·kotlin