linechartanimationitem_p.h
50 lines
| 1.2 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
|
r349 | LineChartAnimationItem(ChartPresenter* presenter, QLineSeries *series, QGraphicsItem *parent = 0); | ||
Michal Klocek
|
r131 | virtual ~LineChartAnimationItem(); | ||
Michal Klocek
|
r391 | protected: | ||
virtual void updateItem(QVector<QPointF>& oldPoints,QVector<QPointF>& newPoints); | ||||
virtual void updateItem(QVector<QPointF>& oldPoints,int index,QPointF& newPoint); | ||||
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 | ||