1
0
This commit is contained in:
Gary Wang
2019-09-30 13:11:43 +08:00
parent d106d9beee
commit 89c21bc90b
5 changed files with 25 additions and 0 deletions

View File

@@ -6,6 +6,8 @@
#include <QGraphicsItem>
#include <QUrl>
#include <QGraphicsSvgItem>
#include <QMovie>
#include <QLabel>
GraphicsScene::GraphicsScene(QObject *parent)
: QGraphicsScene(parent)
@@ -42,3 +44,16 @@ void GraphicsScene::showSvg(const QString &filepath)
m_theThing = svgItem;
this->setSceneRect(m_theThing->boundingRect());
}
void GraphicsScene::showGif(const QString &filepath)
{
this->clear();
QMovie * movie = new QMovie(filepath);
QLabel * label = new QLabel;
label->setStyleSheet("background-color:white;");
label->setMovie(movie);
this->addWidget(label);
movie->start();
m_theThing = this->addRect(QRect(QPoint(0, 0), movie->scaledSize()));
this->setSceneRect(m_theThing->boundingRect());
}