Pass a parent pointer to the Animation instance to avoid memory leak
The leak is just on termination, but we should show good practices in our examples Change-Id: I39abb7545d3c68a1a537b865ba3fcb5e60c22fbf Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> (cherry picked from commit 30947c7fd4dddd76b69a3aa11567e27174d7a3ea) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
b46e179186
commit
f442fcaa6c
@ -62,8 +62,8 @@ public:
|
|||||||
CirclePath,
|
CirclePath,
|
||||||
NPathTypes
|
NPathTypes
|
||||||
};
|
};
|
||||||
Animation(QObject *target, const QByteArray &prop)
|
Animation(QObject *target, const QByteArray &prop, QObject *parent = nullptr)
|
||||||
: QPropertyAnimation(target, prop)
|
: QPropertyAnimation(target, prop, parent)
|
||||||
{
|
{
|
||||||
setPathType(LinearPath);
|
setPathType(LinearPath);
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ Window::Window(QWidget *parent)
|
|||||||
m_scene.addItem(m_item);
|
m_scene.addItem(m_item);
|
||||||
m_ui.graphicsView->setScene(&m_scene);
|
m_ui.graphicsView->setScene(&m_scene);
|
||||||
|
|
||||||
m_anim = new Animation(m_item, "pos");
|
m_anim = new Animation(m_item, "pos", this);
|
||||||
m_anim->setEasingCurve(QEasingCurve::OutBounce);
|
m_anim->setEasingCurve(QEasingCurve::OutBounce);
|
||||||
m_ui.easingCurvePicker->setCurrentRow(int(QEasingCurve::OutBounce));
|
m_ui.easingCurvePicker->setCurrentRow(int(QEasingCurve::OutBounce));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user