Qt设置软件启动动画(开屏动画、欢迎界面)

您所在的位置:网站首页 软件启动界面 Qt设置软件启动动画(开屏动画、欢迎界面)

Qt设置软件启动动画(开屏动画、欢迎界面)

2024-07-12 19:44| 来源: 网络整理| 查看: 265

启动动画的相关接口为QSplashScreen。

版本1:显示图片+延时

代码很简单,只需要在main.cpp中添加几行代码即可实现:

#include "pclvisualizer.h" #include #include //添加QDateTime头文件 #include #include int main(int argc, char* argv[]) { QApplication a(argc, argv); QPixmap pixmap("Qt.png"); //读取图片 QSplashScreen splash(pixmap); // splash.setWindowOpacity(0.8); // 设置窗口透明度 splash.show(); splash.showMessage("程序正在加载......", Qt::AlignCenter, Qt::red); //显示文字 QDateTime time = QDateTime::currentDateTime(); QDateTime currentTime = QDateTime::currentDateTime(); //记录当前时间 while (time.secsTo(currentTime)


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3