@@ -100,13 +100,16 void ChartAnimator::updateAnimation(PieChartItem *item, PieSliceItem *sliceItem, | |||
|
100 | 100 | void ChartAnimator::updateLayout(BarChartItem *item, const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout) |
|
101 | 101 | { |
|
102 | 102 | BarAnimation *animation = static_cast<BarAnimation *>(m_animations.value(item)); |
|
103 | Q_ASSERT(animation); | |
|
104 |
animation |
|
|
103 | m_animations.remove(item); | |
|
104 | if (animation) { | |
|
105 | animation->deleteLater(); | |
|
106 | animation = 0; | |
|
107 | } | |
|
108 | addAnimation(item); | |
|
109 | animation = static_cast<BarAnimation *>(m_animations.value(item)); | |
|
105 | 110 | animation->setDuration(ChartAnimationDuration); |
|
106 | animation->setStartValue(qVariantFromValue(oldLayout)); | |
|
107 | 111 | animation->setKeyValueAt(0.0, qVariantFromValue(oldLayout)); |
|
108 | 112 | animation->setKeyValueAt(1.0, qVariantFromValue(newLayout)); |
|
109 | animation->setEndValue(qVariantFromValue(newLayout)); | |
|
110 | 113 | QTimer::singleShot(0, animation, SLOT(start())); |
|
111 | 114 | } |
|
112 | 115 |
@@ -163,6 +163,9 void BarChartItem::applyLayout(const QVector<QRectF> &layout) | |||
|
163 | 163 | |
|
164 | 164 | void BarChartItem::setLayout(const QVector<QRectF> &layout) |
|
165 | 165 | { |
|
166 | if (layout.count() != m_bars.count()) | |
|
167 | return; | |
|
168 | ||
|
166 | 169 | m_layout = layout; |
|
167 | 170 |
|
|
168 | 171 |
|
General Comments 0
You need to be logged in to leave comments.
Login now