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

运行图

启动图片

启动后程序

相关推荐
张哈大2 小时前
【 Redis | 实战篇 秒杀实现 】
数据库·redis·缓存
weixin_472339462 小时前
Postgresql与openguass对比
数据库·postgresql
鸿蒙布道师3 小时前
鸿蒙NEXT开发动画案例5
android·ios·华为·harmonyos·鸿蒙系统·arkui·huawei
惊起白鸽4507 小时前
MySQL全量,增量备份与恢复
数据库·mysql
暮雨疏桐8 小时前
MySQL SQL Mode及其说明
数据库·sql·mysql·sql mode
Tangcan-8 小时前
【MySQL】数据库基础
数据库·mysql
橙子199110168 小时前
在 Kotlin 中什么是委托属性,简要说说其使用场景和原理
android·开发语言·kotlin
androidwork8 小时前
Kotlin Android LeakCanary内存泄漏检测实战
android·开发语言·kotlin
蔡蓝8 小时前
Mysql的索引,慢查询和数据库表的设计以及乐观锁和悲观锁
数据库·mysql
jstart千语8 小时前
【Redis】分布式锁的实现
数据库·redis·分布式