#ifndef LINECHARTITEM_H #define LINECHARTITEM_H #include "qchartglobal.h" #include "chartitem_p.h" #include QTCOMMERCIALCHART_BEGIN_NAMESPACE class ChartPresenter; class QLineSeries; class LineChartItem : public QObject , public ChartItem { Q_OBJECT public: LineChartItem(ChartPresenter* presenter, QLineSeries* series,QGraphicsItem *parent = 0); ~ LineChartItem(){}; //from QGraphicsItem QRectF boundingRect() const; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); QPainterPath shape() const; void setPen(const QPen& pen); void setPointsVisible(bool visible); public slots: void handlePointAdded(int index); void handlePointRemoved(int index); void handlePointReplaced(int index); void handleDomainChanged(const Domain& domain); void handleGeometryChanged(const QRectF& size); protected: virtual void addPoint(const QPointF& ); virtual void addPoints(const QVector& points); virtual void removePoint(const QPointF& point); virtual void replacePoint(const QPointF& oldPoint, const QPointF& newPoint); virtual void replacePoint(int index,const QPointF& point); virtual void updateItem(QVector& points,QVector& map); virtual void applyGeometry(QVector& points); void clear(); QPointF calculatePoint(int index) const; void calculatePoints(QVector& points,QVector& map) const; private: ChartPresenter* m_presenter; QPainterPath m_path; QSizeF m_size; QRectF m_rect; QRectF m_clipRect; Domain m_domain; QList m_items; QVector m_points; QVector m_map; QLineSeries* m_series; QPen m_pen; }; QTCOMMERCIALCHART_END_NAMESPACE #endif