2 #include "ui_loadingwidget.h"
3 #include <QFontMetrics>
11 setWindowFlags(Qt::FramelessWindowHint | Qt::Dialog);
12 setAttribute(Qt::WA_TranslucentBackground);
17 splashTimer.setInterval(50);
18 splashTimer.setSingleShot(
false);
19 connect(&splashTimer,SIGNAL(timeout()),
this,SLOT(onSplashTimer()),Qt::DirectConnection);
28 void LoadingWidget::onSplashTimer()
30 QString name = QString(
":/images/splash/bg%1.png").arg(counter+1);
32 counter = counter % 8;
33 ui->loadingIco->setPixmap(QPixmap(name));
34 ui->loadingIco->repaint();
41 ui->text->setText(msg);
42 QFont
f = ui->text->font();
43 QFontMetrics metric = QFontMetrics(
f);
45 int w = metric.width(msg);
52 QWidget *w =((QWidget*)parent());
53 int x = w->x() + ((w->width() - width()) / 2);
54 int y = w->y() + ((w->height() - height()) / 2);
55 this->setGeometry(
x,
y,width(),height());