From bca04263a9c1994d075911cf045b458a9fb50ce2 2012-03-15 09:33:26 From: Michal Klocek Date: 2012-03-15 09:33:26 Subject: [PATCH] Bugfix wrong index when points added to xychart --- diff --git a/src/animations/xyanimation.cpp b/src/animations/xyanimation.cpp index a9a919d..b95168e 100644 --- a/src/animations/xyanimation.cpp +++ b/src/animations/xyanimation.cpp @@ -55,7 +55,8 @@ QVariant XYAnimation::interpolated(const QVariant &start, const QVariant & end, case MoveDownAnimation: { - Q_ASSERT(startVector.count() == endVector.count()); + if(startVector.count() != endVector.count()) break; + for(int i =0;i< startVector.count();i++) { qreal x = startVector[i].x() + ((endVector[i].x()- startVector[i].x()) * progress); qreal y = startVector[i].y() + ((endVector[i].y()- startVector[i].y()) * progress); diff --git a/src/xychart/xychartitem.cpp b/src/xychart/xychartitem.cpp index 57488a4..a383c67 100644 --- a/src/xychart/xychartitem.cpp +++ b/src/xychart/xychartitem.cpp @@ -94,7 +94,7 @@ void XYChartItem::handlePointAdded(int index) QPointF point = calculateGeometryPoint(index); QVector points = m_points; - points.insert(index,point); + points.insert(index-1,point); updateLayout(points); update(); } @@ -102,7 +102,6 @@ void XYChartItem::handlePointRemoved(int index) { Q_ASSERT(indexcount() + 1); Q_ASSERT(index>=0); -// QPointF point = calculateGeometryPoint(index); QVector points = m_points; points.remove(index); updateLayout(points);