@@ -70,7 +70,10 QPainterPath LineChartItem::shape() const | |||||
70 |
|
70 | |||
71 | void LineChartItem::updateGeometry() |
|
71 | void LineChartItem::updateGeometry() | |
72 | { |
|
72 | { | |
73 | const QVector<QPointF> &points = geometryPoints(); |
|
73 | // Store the points to a local variable so that the old line gets properly cleared | |
|
74 | // when animation starts. | |||
|
75 | m_linePoints = geometryPoints(); | |||
|
76 | const QVector<QPointF> &points = m_linePoints; | |||
74 |
|
77 | |||
75 | if (points.size() == 0) { |
|
78 | if (points.size() == 0) { | |
76 | prepareGeometryChange(); |
|
79 | prepareGeometryChange(); | |
@@ -377,8 +380,8 void LineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt | |||||
377 | // to ensure proper continuity of the pattern |
|
380 | // to ensure proper continuity of the pattern | |
378 | painter->drawPath(m_linePath); |
|
381 | painter->drawPath(m_linePath); | |
379 | } else { |
|
382 | } else { | |
380 |
for (int i(1); i < m_ |
|
383 | for (int i(1); i < m_linePoints.size(); i++) | |
381 |
painter->drawLine(m_ |
|
384 | painter->drawLine(m_linePoints.at(i - 1), m_linePoints.at(i)); | |
382 | } |
|
385 | } | |
383 | } |
|
386 | } | |
384 |
|
387 | |||
@@ -389,7 +392,7 void LineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt | |||||
389 | painter->setClipping(true); |
|
392 | painter->setClipping(true); | |
390 | else |
|
393 | else | |
391 | painter->setClipping(false); |
|
394 | painter->setClipping(false); | |
392 |
m_series->d_func()->drawSeriesPointLabels(painter, m_ |
|
395 | m_series->d_func()->drawSeriesPointLabels(painter, m_linePoints, m_linePen.width() / 2); | |
393 | } |
|
396 | } | |
394 |
|
397 | |||
395 | painter->restore(); |
|
398 | painter->restore(); |
@@ -74,6 +74,7 private: | |||||
74 | QPainterPath m_fullPath; |
|
74 | QPainterPath m_fullPath; | |
75 | QPainterPath m_shapePath; |
|
75 | QPainterPath m_shapePath; | |
76 |
|
76 | |||
|
77 | QVector<QPointF> m_linePoints; | |||
77 | QRectF m_rect; |
|
78 | QRectF m_rect; | |
78 | QPen m_linePen; |
|
79 | QPen m_linePen; | |
79 | bool m_pointsVisible; |
|
80 | bool m_pointsVisible; |
General Comments 0
You need to be logged in to leave comments.
Login now