:gif:
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user