1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| WaitDialog::WaitDialog(QWidget* pParent, Qt::WindowFlags pFlag)
:QDialog(pParent)
,mFrame(0)
{
setWindowFlags(pFlag);
mUi.setupUi(this);
mStartTime.start();
QTimer::singleShot(100, this, SLOT(updateInfos()));
}
void WaitDialog::updateInfos()
{
// Set current pixmap
if
(mFrame == mWaitDialogPixmaps->size())
{
mFrame = 0;
}
mUi.label->setPixmap((*mWaitDialogPixmaps)[mFrame++]);
// Set elapsed time.
QTime lElapsed(0, 0, 0, 0);
lElapsed = lElapsed.addMSecs(mStartTime.elapsed());
mUi.mLElapsedTime->setText(lElapsed.toString("HH:mm:ss"));
QApplication::processEvents();
QTimer::singleShot(100, this, SLOT(updateInfos()));
}
void VA_WaitDialog::showInstance()
{
if
(!msInstance)
{
msInstance = new VA_WaitDialog();
msInstance->show();
}
}
void VA_WaitDialog::hideInstance()
{
if
(msInstance)
delete msInstance;
} |
Partager