1 Star 0 Fork 82

Jun Seow / Landlords

forked from ibc-dabing / Landlords 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
loading.cpp 1004 Bytes
一键复制 编辑 原始数据 按行查看 历史
kevin 提交于 2021-12-07 23:24 . add file
#include "gamepanel.h"
#include "loading.h"
#include <QPainter>
#include <QTimer>
Loading::Loading(QWidget *parent) : QWidget(parent)
{
m_bk.load(":/images/loading.png");
setFixedSize(m_bk.size());
setWindowFlags(Qt::FramelessWindowHint | windowFlags());
setAttribute(Qt::WA_TranslucentBackground);
QPixmap pixmap(":/images/progress.png");
QTimer* timer = new QTimer(this);
connect(timer, &QTimer::timeout, this, [=](){
m_progress = pixmap.copy(0, 0, m_dist, pixmap.height());
update();
if(m_dist >= pixmap.width())
{
timer->stop();
timer->deleteLater();
GamePanel* panel = new GamePanel;
panel->show();
close();
}
m_dist += 5;
});
timer->start(15);
}
void Loading::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event)
QPainter p(this);
p.drawPixmap(rect(), m_bk);
p.drawPixmap(62, 417, m_progress.width(), m_progress.height(), m_progress);
}
1
https://gitee.com/junjia2003/landlords.git
git@gitee.com:junjia2003/landlords.git
junjia2003
landlords
Landlords
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891