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

运行图

启动图片

启动后程序

相关推荐
LUCIAZZZ1 小时前
简单的SQL语句的快速复习
java·数据库·sql
Elastic 中国社区官方博客3 小时前
使用真实 Elasticsearch 进行高级集成测试
大数据·数据库·elasticsearch·搜索引擎·全文检索·jenkins·集成测试
@_@哆啦A梦3 小时前
Redis 基础命令
java·数据库·redis
fajianchen3 小时前
MySQL 索引存储结构
数据库·mysql
恋猫de小郭3 小时前
Android Studio 正式版 10 周年回顾,承载 Androider 的峥嵘十年
android·ide·android studio
想做富婆3 小时前
oracle: 多表查询之联合查询[交集intersect, 并集union,差集minus]
数据库·oracle·联合查询
xianwu5435 小时前
反向代理模块jmh
开发语言·网络·数据库·c++·mysql
Leven1995275 小时前
Flink (十三) :Table API 与 DataStream API 的转换 (一)
数据库·sql·flink
geovindu5 小时前
neo4j-community-5.26.0 create new database
数据库·mysql·neo4j
行十万里人生5 小时前
Qt事件处理:理解处理器、过滤器与事件系统
开发语言·git·qt·华为od·华为·华为云·harmonyos