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