#include "waitingdlg.h" #include #include WaitingDlg::WaitingDlg(QWidget *parent, QString text) : BaseDlg{parent} { setAttribute(Qt::WA_DeleteOnClose); setModal(true); auto pal = palette(); pal.setBrush(QPalette::Window, QColor(0xdddddd)); setPalette(pal); auto vBox = new QVBoxLayout(this); vBox->addStretch(); mIndicator = new CustomProgressIndicator(this); mIndicator->setDisplayModel(1); mIndicator->setColor(QColor(0x0088dd)); mIndicator->startAnimation(); vBox->addWidget(mIndicator, 0, Qt::AlignCenter); vBox->addStretch(); fdText = new QLabel(text); fdText->setAlignment(Qt::AlignCenter); auto font = fdText->font(); font.setPixelSize(18); font.setBold(true); fdText->setFont(font); pal = fdText->palette(); pal.setBrush(QPalette::WindowText, QColor(0x0088dd)); fdText->setPalette(pal); vBox->addWidget(fdText); vBox->addStretch(); } void WaitingDlg::timerEvent(QTimerEvent *event) { if(closeTimerId==event->timerId()) { killTimer(closeTimerId); closeTimerId = 0; close(); } else BaseDlg::timerEvent(event); } void WaitingDlg::success() { fdText->setText(tr("Success")); mIndicator->setBackground(":/res/success.png"); mIndicator->stopAnimation(); closeTimerId = startTimer(800); }