You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
965 B
51 lines
965 B
4 years ago
|
#include "waitdialog.h"
|
||
|
#include "ui_waitdialog.h"
|
||
|
|
||
|
#include <QTimer>
|
||
|
#include <QDebug>
|
||
|
|
||
|
WaitDialog::WaitDialog(QWidget *parent) :
|
||
|
QDialog(parent),
|
||
|
ui(new Ui::WaitDialog)
|
||
|
{
|
||
|
ui->setupUi(this);
|
||
|
|
||
|
_timer = new QTimer();
|
||
|
|
||
|
connect(_timer, &QTimer::timeout, this, &WaitDialog::timeout);
|
||
|
|
||
|
_timer->start(250);
|
||
|
|
||
|
setText();
|
||
|
}
|
||
|
|
||
|
/*************************************************************************************************/
|
||
|
WaitDialog::~WaitDialog()
|
||
|
{
|
||
|
delete ui;
|
||
|
|
||
|
delete _timer;
|
||
|
}
|
||
|
|
||
|
/*************************************************************************************************/
|
||
|
void WaitDialog::timeout()
|
||
|
{
|
||
|
setText();
|
||
|
}
|
||
|
|
||
|
/*************************************************************************************************/
|
||
|
void WaitDialog::setText()
|
||
|
{
|
||
|
QString str = "Please wait";
|
||
|
|
||
|
for(auto i = 0; i < _state; i++)
|
||
|
str += ".";
|
||
|
|
||
|
_state++;
|
||
|
|
||
|
if(_state > 3)
|
||
|
_state = 0;
|
||
|
|
||
|
ui->l_text->setText(str);
|
||
|
}
|