linechartanimationitem_p.h
50 lines
| 1.1 KiB
| text/x-c
|
CLexer
Michal Klocek
|
r145 | #ifndef LINECHARTANIMATIONITEM_P_H_ | ||
#define LINECHARTANIMATIONITEM_P_H_ | ||||
Michal Klocek
|
r131 | |||
#include "qchartglobal.h" | ||||
Michal Klocek
|
r145 | #include "linechartitem_p.h" | ||
Michal Klocek
|
r131 | #include "domain_p.h" | ||
Michal Klocek
|
r391 | #include <QVariantAnimation> | ||
Michal Klocek
|
r131 | |||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
Michal Klocek
|
r391 | class LineChartAnimatator; | ||
Michal Klocek
|
r131 | |||
Michal Klocek
|
r145 | class LineChartAnimationItem : public LineChartItem { | ||
Michal Klocek
|
r389 | |||
Michal Klocek
|
r391 | Q_OBJECT | ||
Michal Klocek
|
r131 | public: | ||
Michal Klocek
|
r439 | LineChartAnimationItem(QLineSeries *series, QGraphicsItem *parent = 0); | ||
Michal Klocek
|
r131 | virtual ~LineChartAnimationItem(); | ||
Michal Klocek
|
r391 | protected: | ||
Michal Klocek
|
r465 | virtual void updatePoints(QVector<QPointF>& newPoints); | ||
Michal Klocek
|
r464 | virtual void updatePoint(int index,QPointF& newPoint); | ||
Michal Klocek
|
r391 | |||
private slots: | ||||
void startAnimation(); | ||||
Michal Klocek
|
r131 | |||
private: | ||||
Michal Klocek
|
r391 | LineChartAnimatator *m_animation; | ||
QVector<QPointF> m_points; | ||||
bool m_dirty; | ||||
Michal Klocek
|
r131 | }; | ||
Michal Klocek
|
r389 | class LineChartAnimatator: public QVariantAnimation | ||
Michal Klocek
|
r131 | { | ||
public: | ||||
Michal Klocek
|
r391 | LineChartAnimatator(LineChartAnimationItem *item, QObject *parent = 0 ); | ||
~LineChartAnimatator(); | ||||
Michal Klocek
|
r389 | |||
Michal Klocek
|
r391 | protected: | ||
QVariant interpolated(const QVariant &start, const QVariant & end, qreal progress ) const; | ||||
void updateCurrentValue (const QVariant & value ); | ||||
private: | ||||
Michal Klocek
|
r131 | LineChartAnimationItem* m_item; | ||
}; | ||||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
Michal Klocek
|
r145 | #endif | ||