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

运行图

启动图片

启动后程序

相关推荐
努力努力再努力wz8 分钟前
【MySQL进阶系列】一文打通事务机制:从锁、Undo Log 到 MVCC 与隔离级别
c语言·数据结构·数据库·c++·mysql·算法·github
xingpanvip21 分钟前
星盘接口开发文档:组合三限盘接口指南
android·开发语言·前端·python·php·lua
PaperData26 分钟前
2000-2025年《中国县域统计年鉴》pdf+excel版(附赠面板数据)
数据库·人工智能·数据分析·pdf·经管
冷小鱼32 分钟前
从关系模型(SQL)基石到AI与信创时代的智能查询语言
数据库·sql
LLON erva42 分钟前
Redis-配置文件
数据库·redis·oracle
童话ing43 分钟前
【Redis】026 互联网大厂 Redis 面试高频题
数据库·redis·面试
钰衡大师44 分钟前
Activiti 7 工作流技术文档
java·数据库·spring boot
Treh UNFO1 小时前
nginx的重定向
大数据·数据库·nginx
TechMix1 小时前
【fkw学习笔记】Android 13 AOSP 源码添加系统预置应用实战指南
android·笔记·学习
jvvz afqh1 小时前
mysql用户名怎么看
数据库·mysql