##// END OF EJS Templates
Fix grid animation to do not go out of bound
Michal Klocek -
r504:142210a64aff
parent child
Show More
@@ -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::InOutBack);
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()));
@@ -49,6 +49,8 public:
49 49 void setLabelsBrush(const QBrush& brush);
50 50 void setLabelsFont(const QFont& font);
51 51
52 QRectF geometry() const { return m_rect; }
53
52 54 public slots:
53 55 void handleAxisUpdated();
54 56 void handleAxisCategoriesUpdated();
General Comments 0
You need to be logged in to leave comments. Login now