From 142210a64affa98d6edcb9ab48420190c0032d58 2012-03-08 08:26:26 From: Michal Klocek Date: 2012-03-08 08:26:26 Subject: [PATCH] Fix grid animation to do not go out of bound --- diff --git a/src/axis/axisanimationitem.cpp b/src/axis/axisanimationitem.cpp index 6f4132a..0379102 100644 --- a/src/axis/axisanimationitem.cpp +++ b/src/axis/axisanimationitem.cpp @@ -19,17 +19,26 @@ AxisAnimationItem::~AxisAnimationItem() void AxisAnimationItem::updateLayout(QVector& newLayout) { + QVector oldLayout = layout(); if(newLayout.count()==0) return; + + QRectF rect = geometry(); + oldLayout.resize(newLayout.size()); + for(int i=0;istate()!=QAbstractAnimation::Stopped){ m_animation->stop(); } m_animation->setDuration(duration); - m_animation->setEasingCurve(QEasingCurve::InOutBack); + m_animation->setEasingCurve(QEasingCurve::OutQuart); m_animation->setKeyValueAt(0.0, qVariantFromValue(oldLayout)); m_animation->setKeyValueAt(1.0, qVariantFromValue(newLayout)); QTimer::singleShot(0,m_animation,SLOT(start())); diff --git a/src/axis/axisitem_p.h b/src/axis/axisitem_p.h index e971f22..6edbebe 100644 --- a/src/axis/axisitem_p.h +++ b/src/axis/axisitem_p.h @@ -49,6 +49,8 @@ public: void setLabelsBrush(const QBrush& brush); void setLabelsFont(const QFont& font); + QRectF geometry() const { return m_rect; } + public slots: void handleAxisUpdated(); void handleAxisCategoriesUpdated();