当前位置:网站首页>QT等待框制作
QT等待框制作
2022-07-01 05:16:00 【rainbow_lucky0106】
QMovie + GIF
#include "DWaitProcessDlg.h"
DWaitProcessDlg::DWaitProcessDlg(const QString &title, QWidget *parent) : QDialog(parent)
{
this->setFixedSize(100, 100);
this->setWindowOpacity(0.8);
this->setWindowFlags(Qt::FramelessWindowHint | Qt::Dialog);
this->setAttribute(Qt::WA_TranslucentBackground, true);
m_frameBg = new QFrame(this);
m_frameBg->setStyleSheet("background-color: rgb(55, 135,215); border-radius:10px;");
m_frameBg->setGeometry(0, 0, 100, 100);
m_labelLogo = new QLabel(m_frameBg);
m_labelLogo->setStyleSheet("background-color:transparent;");
m_labelLogo->setGeometry(30, 15, 40, 40);
m_movieLogo = new QMovie(":/Resource/images/spinner.svg");
m_labelLogo->setScaledContents(true);
m_labelLogo->setMovie(m_movieLogo);
m_labelTip = new QLabel(m_frameBg);
m_labelTip->setText(title);
m_labelTip->setStyleSheet("color: white;background-color: transparent;");
m_labelTip->setGeometry(10, 70, 80, 20);
m_movieLogo->start();
}
DWaitProcessDlg::~DWaitProcessDlg()
{
m_movieLogo->stop();
delete m_labelLogo;
delete m_movieLogo;
delete m_labelLogo;
delete m_frameBg;
}
调用方式
QApplication::setOverrideCursor(Qt::WaitCursor);//设置鼠标为等待状态
QString strTip = "导出数据中...";
DWaitProcessDlg *pWaitDlg = new DWaitProcessDlg(strTip, this);
pWaitDlg->show();
for(int i=0; i<list.count(); i++)
{
QCoreApplication::processEvents();
}
QApplication::restoreOverrideCursor();
pWaitDlg->close();
边栏推荐
- Use and principle of AQS related implementation classes
- Lock free concurrency of JUC (leguan lock)
- Thread safety issues
- 导电滑环使用的注意事项
- 轻松上手Fluentd,结合 Rainbond 插件市场,日志收集更快捷
- 【暑期每日一题】洛谷 P7222 [RC-04] 信息学竞赛
- QDataStream的簡單讀寫驗證
- How to meet the requirements of source code confidentiality and source code security management
- AcWing 888. Finding combinatorial number IV (the problem of finding combinatorial number with high precision)
- FileOutPutStream
猜你喜欢

Application of industrial conductive slip ring

Usage and principle of synchronized

Design and application of immutable classes

el-cascader回显失败;el-cascader回显不出来

LeetCode1497-检查数组对是否可以被 k 整除-数组-哈希表-计数

eBPF Cilium实战(2) - 底层网络可观测性

Rainbow combines neuvector to practice container safety management

第05天-文件操作函数

Tcp/ip explanation (version 2) notes / 3 link layer / 3.2 Ethernet and IEEE 802 lan/man standards

Leetcode1497- check whether array pairs can be divided by K - array - hash table - count
随机推荐
第05天-文件操作函数
Leetcode316- remove duplicate letters - stack - greedy - string
FileInputStream
Worried about infringement? Must share copyrightless materials on the website. Don't worry about the lack of materials for video clips
FileOutPutStream
AcWing 887. Finding combinatorial number III (Lucas theorem)
AcWing 888. Finding combinatorial number IV (the problem of finding combinatorial number with high precision)
轻松上手Fluentd,结合 Rainbond 插件市场,日志收集更快捷
担心侵权?必备无版权素材网站分享,不用担心视频剪辑缺素材
Use and principle of wait notify
Mathematical knowledge: finding the number of divisors
Distributed - summary list
複制寶貝提示材質不能為空,如何解决?
Use of STM32 expansion board temperature sensor and temperature humidity sensor
Things generated by busybox
Flutter 实现每次进来界面都刷新数据
【暑期每日一题】洛谷 P7222 [RC-04] 信息学竞赛
Variable binding and deconstruction for rudimentary rust
Rainbow combines neuvector to practice container safety management
How to meet the requirements of source code confidentiality and source code security management