当前位置:网站首页>qt设置加载界面的几种方法
qt设置加载界面的几种方法
2022-07-28 05:25:00 【小土同学!】
前言
介绍两种设置加载界面的方法
静态图片展示
QSplashScreen splash(QPixmap(":/rec/lancoo7.png"));
splash.setDisabled(true);//进制用户的输入事件相应
splash.show();
delayMSec(2000); //非阻塞延迟2s,模拟复杂程序
splash.close();
delaydelayMSec函数为自己封装的方法
void MainWindow::delayMSec(unsigned int msec)
{
QTime Time_set = QTime::currentTime().addMSecs(msec);
while( QTime::currentTime() < Time_set )
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
}
效果

gif图片显示
QPixmap pixmap(":/rec/gif2.gif");
QMovie movie(":/rec/gif2.gif");
QLabel label;
label.setMovie(&movie);
movie.start();
label.setFixedSize(400,400);
movie.setScaledSize(label.size());
label.move(QApplication::desktop()->width()/2-label.width()/2,QApplication::desktop()->height()/2-label.height()/2); //这里如果报错,则添加#include <QDesktopWidget>头文件
label.setWindowFlags(Qt::FramelessWindowHint);//隐藏边框
label.setWindowModality(Qt::ApplicationModal); //阻塞除当前窗体之外的所有的窗体
label.show();
delayMSec(2000); //非阻塞延迟2s,模拟复杂程序
movie.stop();
label.close();
效果

这里是动图,但我没找到背景是透明的gif图片
加载图片资源:
链接:https://pan.baidu.com/s/1_varGLRYZ_IywszB9NLC5w
提取码:snke
–来自百度网盘超级会员V2的分享
码字不易,如果这篇博客对你有帮助,麻烦点赞收藏,非常感谢!有不对的地方
边栏推荐
- Perl入门学习(八)子程序
- PT physical aware based on multi voltage
- CLIP Learning Transferable Visual Models From Natural Language Supervision
- 机器学习笔记 5 —— Logistic Regression
- Bert bidirectional encoder based on transformer
- [yolov5] environment construction: win11 + mx450
- Analysis of MOSFET damage at the moment of power failure of isolated power supply
- Hugging face 的入门使用
- 毕业论文 | 文献综述应该怎么写
- Shuffle Net_v1-shuffle_v2
猜你喜欢

雷达成像 Matlab 仿真 3 —— 多目标检测

A NOVEL DEEP PARALLEL TIME-SERIES RELATION NETWORK FOR FAULT DIAGNOSIS

Low power design -power switch
![[yolov5] environment construction: win11 + mx450](/img/04/4da9b3748d5f45ef73cffcc48f8609.png)
[yolov5] environment construction: win11 + mx450

set_ case_ analysis

OpenGL的开发环境配置【VS2017】+常见问题

What is the AEM testpro cv100 and fluke dsx-8000 of category 8 network cable tester?

简述EMD分解、希尔伯特变换、谱方法

clock tree分析实例

Pycharm2019 set editor theme and default code
随机推荐
VAN(DWConv+DWDilationConv+PWConv)
Matlab simulation of radar imaging 2 - pulse compression and windowing
How to use the bit error meter?
Pytorch learning notes 2 - about tensor
PyTorch 学习笔记 3 —— DATASETS & DATALOADERS & TRANSFORMS
Weight decay
RS232 RS485 RS422 communication learning and notes
Pytorch learning notes
JSP实现文件上传功能的同时还要向后台传递参数
A NOVEL DEEP PARALLEL TIME-SERIES RELATION NETWORK FOR FAULT DIAGNOSIS
Pycharm2019 set editor theme and default code
听说你也在实习|当我采访了几个大三实习生之后。
保研面试中常见的英语问题有哪些?
What is the AEM testpro cv100 and fluke dsx-8000 of category 8 network cable tester?
详解安装msdn 2015及其注意事项
Learning notes on hardware circuit design 2 -- step-down power circuit
Bag of tricks training convolution network skills
Shuffle Net_v1-shuffle_v2
Bag of Tricks训练卷积网络的技巧
雷达成像 Matlab 仿真 4 —— 距离分辨率分析