fix: memory leak when switching between animated image files
This commit is contained in:
parent
8b86fb1434
commit
71e8df3107
|
@ -51,8 +51,8 @@ void GraphicsScene::showSvg(const QString &filepath)
|
||||||
void GraphicsScene::showAnimated(const QString &filepath)
|
void GraphicsScene::showAnimated(const QString &filepath)
|
||||||
{
|
{
|
||||||
this->clear();
|
this->clear();
|
||||||
QMovie * movie = new QMovie(filepath);
|
|
||||||
QLabel * label = new QLabel;
|
QLabel * label = new QLabel;
|
||||||
|
QMovie * movie = new QMovie(filepath, QByteArray(), label);
|
||||||
label->setStyleSheet("background-color:rgba(225,255,255,0);");
|
label->setStyleSheet("background-color:rgba(225,255,255,0);");
|
||||||
label->setMovie(movie);
|
label->setMovie(movie);
|
||||||
this->addWidget(label);
|
this->addWidget(label);
|
||||||
|
|
|
@ -50,7 +50,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
m_floatUpAnimation = new QPropertyAnimation(this, "geometry");
|
m_floatUpAnimation = new QPropertyAnimation(this, "geometry");
|
||||||
m_floatUpAnimation->setDuration(300);
|
m_floatUpAnimation->setDuration(300);
|
||||||
m_floatUpAnimation->setEasingCurve(QEasingCurve::OutCirc);
|
m_floatUpAnimation->setEasingCurve(QEasingCurve::OutCirc);
|
||||||
m_exitAnimationGroup = new QParallelAnimationGroup;
|
m_exitAnimationGroup = new QParallelAnimationGroup(this);
|
||||||
m_exitAnimationGroup->addAnimation(m_fadeOutAnimation);
|
m_exitAnimationGroup->addAnimation(m_fadeOutAnimation);
|
||||||
m_exitAnimationGroup->addAnimation(m_floatUpAnimation);
|
m_exitAnimationGroup->addAnimation(m_floatUpAnimation);
|
||||||
connect(m_exitAnimationGroup, &QParallelAnimationGroup::finished,
|
connect(m_exitAnimationGroup, &QParallelAnimationGroup::finished,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user