diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2013-06-10 10:30:22 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2013-06-10 10:38:27 +0300 |
commit | 3dd93906f007479864adfd7e4962b92a9d85a12d (patch) | |
tree | 09836140a12f6979ed6e6de0d21edb53ecc5e2dc /src/animations | |
parent | a2f72685ff335e4beb09df76d0513e7f8355a8a8 (diff) |
Further crash fixes to boxplot
Change-Id: Ic14119490bb39a7040d4bed65af4f19548846a89
Reviewed-by: Mika Salmela <mika.salmela@digia.com>
Diffstat (limited to 'src/animations')
-rw-r--r-- | src/animations/boxplotanimation.cpp | 12 | ||||
-rw-r--r-- | src/animations/boxplotanimation_p.h | 1 | ||||
-rw-r--r-- | src/animations/boxwhiskersanimation.cpp | 7 | ||||
-rw-r--r-- | src/animations/boxwhiskersanimation_p.h | 3 |
4 files changed, 17 insertions, 6 deletions
diff --git a/src/animations/boxplotanimation.cpp b/src/animations/boxplotanimation.cpp index a73aa7d4..c5880a88 100644 --- a/src/animations/boxplotanimation.cpp +++ b/src/animations/boxplotanimation.cpp @@ -39,7 +39,7 @@ void BoxPlotAnimation::addBox(BoxWhiskers *box) { BoxWhiskersAnimation *animation = m_animations.value(box); if (!animation) { - animation = new BoxWhiskersAnimation(box); + animation = new BoxWhiskersAnimation(box, this); m_animations.insert(box, animation); BoxWhiskersData start; start.m_median = box->m_data.m_median; @@ -76,10 +76,16 @@ void BoxPlotAnimation::setAnimationStart(BoxWhiskers *box) void BoxPlotAnimation::stopAll() { - foreach (BoxWhiskersAnimation *animation, m_animations.values()) + foreach (BoxWhiskers *box, m_animations.keys()) { + BoxWhiskersAnimation *animation = m_animations.value(box); animation->stopAndDestroyLater(); + m_animations.remove(box); + } } -//#include "moc_boxplotanimation_p.cpp" +void BoxPlotAnimation::removeBoxAnimation(BoxWhiskers *box) +{ + m_animations.remove(box); +} QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/animations/boxplotanimation_p.h b/src/animations/boxplotanimation_p.h index 9a644909..2f99b811 100644 --- a/src/animations/boxplotanimation_p.h +++ b/src/animations/boxplotanimation_p.h @@ -52,6 +52,7 @@ public: void setAnimationStart(BoxWhiskers *box); void stopAll(); + void removeBoxAnimation(BoxWhiskers *box); protected: BoxPlotChartItem *m_item; diff --git a/src/animations/boxwhiskersanimation.cpp b/src/animations/boxwhiskersanimation.cpp index a46aa76a..2ce9352c 100644 --- a/src/animations/boxwhiskersanimation.cpp +++ b/src/animations/boxwhiskersanimation.cpp @@ -29,9 +29,10 @@ Q_DECLARE_METATYPE(qreal) QTCOMMERCIALCHART_BEGIN_NAMESPACE -BoxWhiskersAnimation::BoxWhiskersAnimation(BoxWhiskers *box) +BoxWhiskersAnimation::BoxWhiskersAnimation(BoxWhiskers *box, BoxPlotAnimation *boxPlotAnimation) : ChartAnimation(box), - m_box(box) + m_box(box), + m_boxPlotAnimation(boxPlotAnimation) { setDuration(ChartAnimationDuration); setEasingCurve(QEasingCurve::OutQuart); @@ -39,6 +40,8 @@ BoxWhiskersAnimation::BoxWhiskersAnimation(BoxWhiskers *box) BoxWhiskersAnimation::~BoxWhiskersAnimation() { + if (m_boxPlotAnimation) + m_boxPlotAnimation->removeBoxAnimation(m_box); } QVariant BoxWhiskersAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const diff --git a/src/animations/boxwhiskersanimation_p.h b/src/animations/boxwhiskersanimation_p.h index 975ced35..dcad2e9e 100644 --- a/src/animations/boxwhiskersanimation_p.h +++ b/src/animations/boxwhiskersanimation_p.h @@ -43,7 +43,7 @@ class BoxWhiskersAnimation : public ChartAnimation Q_OBJECT public: - BoxWhiskersAnimation(BoxWhiskers *box); + BoxWhiskersAnimation(BoxWhiskers *box, BoxPlotAnimation *boxPlotAnimation); ~BoxWhiskersAnimation(); public: // from QVariantAnimation @@ -60,6 +60,7 @@ protected: friend class BoxPlotAnimation; BoxWhiskers *m_box; bool m_moveMedianLine; + BoxPlotAnimation *m_boxPlotAnimation; }; QTCOMMERCIALCHART_END_NAMESPACE |