##// END OF EJS Templates
Fix pie animation chrash
Jani Honkonen -
r2321:9b8615dbb840
parent child
Show More
@@ -37,8 +37,12 PieAnimation::~PieAnimation()
37 ChartAnimation *PieAnimation::updateValue(PieSliceItem *sliceItem, const PieSliceData &sliceData)
37 ChartAnimation *PieAnimation::updateValue(PieSliceItem *sliceItem, const PieSliceData &sliceData)
38 {
38 {
39 PieSliceAnimation *animation = m_animations.value(sliceItem);
39 PieSliceAnimation *animation = m_animations.value(sliceItem);
40 Q_ASSERT(animation);
40 if (!animation) {
41 animation->stop();
41 animation = new PieSliceAnimation(sliceItem);
42 m_animations.insert(sliceItem, animation);
43 } else {
44 animation->stop();
45 }
42
46
43 animation->updateValue(sliceData);
47 animation->updateValue(sliceData);
44 animation->setDuration(ChartAnimationDuration);
48 animation->setDuration(ChartAnimationDuration);
@@ -59,8 +59,10 QBrush linearPos(QBrush start, QBrush end, qreal pos)
59
59
60 PieSliceAnimation::PieSliceAnimation(PieSliceItem *sliceItem)
60 PieSliceAnimation::PieSliceAnimation(PieSliceItem *sliceItem)
61 : ChartAnimation(sliceItem),
61 : ChartAnimation(sliceItem),
62 m_sliceItem(sliceItem)
62 m_sliceItem(sliceItem),
63 m_currentValue(m_sliceItem->m_data)
63 {
64 {
65
64 }
66 }
65
67
66 PieSliceAnimation::~PieSliceAnimation()
68 PieSliceAnimation::~PieSliceAnimation()
@@ -81,6 +81,8 private:
81 QPainterPath m_labelArmPath;
81 QPainterPath m_labelArmPath;
82 QRectF m_labelTextRect;
82 QRectF m_labelTextRect;
83 bool m_hovered;
83 bool m_hovered;
84
85 friend class PieSliceAnimation;
84 };
86 };
85
87
86 QTCOMMERCIALCHART_END_NAMESPACE
88 QTCOMMERCIALCHART_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now