#include "protectgamestart.h" #include "ui_protectgamestart.h" #include #include #include #include ProtectGameStart::ProtectGameStart(QWidget *parent) : QWidget(parent) , ui(new Ui::ProtectGameStart) { ui->setupUi(this); this->setWindowFlags(Qt::FramelessWindowHint); //设置无边框 setAttribute(Qt::WA_TranslucentBackground,true); this->setWindowFlags(this->windowFlags() | Qt::WindowStaysOnTopHint); initGif(); } ProtectGameStart::~ProtectGameStart() { if(m_movie) delete m_movie; delete ui; } void ProtectGameStart::initGif() { QString gifPath("./DependFile/Source/dialog/waiting.gif"); m_movie = new QMovie(); m_movie->setScaledSize(ui->gif_Label->size()); m_movie->setFileName(gifPath); ui->gif_Label->setMovie(m_movie); } void ProtectGameStart::showEvent(QShowEvent *event) { Q_UNUSED(event) m_movie->start(); } /* bool ProtectGameStart::setDownPicture(QPixmap downPicture) { //ui->downPictureLabel->setPixmap(downPicture); QPainter myPainter = QPainter(this); myPainter.drawPixmap(0,100,downPicture); } */ void ProtectGameStart::paintEvent(QPaintEvent *event) { Q_UNUSED(event) QPainter painter(this); /* QString dirPath = QApplication::applicationDirPath() + "/DependFile/Source/trainDisplayPage"; QDir resultDir(dirPath); if(!resultDir.exists()) qDebug()<<"加载下图片失败"; QPixmap downPicture,upPicture; downPicture.load(dirPath + "/downPicture.png"); upPicture.load(dirPath + "/upPicture.png"); qDebug()<upPictureLabel->setPixmap(upPicture); */ } void ProtectGameStart::changeEvent(QEvent* event) { switch (event->type()) { case QEvent::LanguageChange: ui->retranslateUi(this); break; default: QWidget::changeEvent(event); break; } }