@@ -19,17 +19,26 AxisAnimationItem::~AxisAnimationItem() | |||
|
19 | 19 | |
|
20 | 20 | void AxisAnimationItem::updateLayout(QVector<qreal>& newLayout) |
|
21 | 21 | { |
|
22 | ||
|
22 | 23 | QVector<qreal> oldLayout = layout(); |
|
23 | 24 | |
|
24 | 25 | if(newLayout.count()==0) return; |
|
26 | ||
|
27 | QRectF rect = geometry(); | |
|
28 | ||
|
25 | 29 | oldLayout.resize(newLayout.size()); |
|
26 | 30 | |
|
31 | for(int i=0;i<oldLayout.count();i++) | |
|
32 | { | |
|
33 | oldLayout[i]= axisType()==X_AXIS?rect.left():rect.top(); | |
|
34 | } | |
|
35 | ||
|
27 | 36 | if(m_animation->state()!=QAbstractAnimation::Stopped){ |
|
28 | 37 | m_animation->stop(); |
|
29 | 38 | } |
|
30 | 39 | |
|
31 | 40 | m_animation->setDuration(duration); |
|
32 |
m_animation->setEasingCurve(QEasingCurve:: |
|
|
41 | m_animation->setEasingCurve(QEasingCurve::OutQuart); | |
|
33 | 42 | m_animation->setKeyValueAt(0.0, qVariantFromValue(oldLayout)); |
|
34 | 43 | m_animation->setKeyValueAt(1.0, qVariantFromValue(newLayout)); |
|
35 | 44 | QTimer::singleShot(0,m_animation,SLOT(start())); |
General Comments 0
You need to be logged in to leave comments.
Login now