linechartitem_p.h
63 lines
| 1.6 KiB
| text/x-c
|
CLexer
|
r144 | #ifndef LINECHARTITEM_H | ||
#define LINECHARTITEM_H | ||||
|
r21 | |||
|
r30 | #include "qchartglobal.h" | ||
|
r104 | #include "chartitem_p.h" | ||
|
r139 | #include <QPen> | ||
|
r21 | |||
|
r30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||
|
r21 | |||
|
r131 | class ChartPresenter; | ||
|
r349 | class QLineSeries; | ||
|
r21 | |||
|
r144 | class LineChartItem : public QObject , public ChartItem | ||
|
r21 | { | ||
|
r131 | Q_OBJECT | ||
|
r21 | public: | ||
|
r439 | LineChartItem(QLineSeries* series,QGraphicsItem *parent = 0); | ||
|
r144 | ~ LineChartItem(){}; | ||
|
r21 | |||
//from QGraphicsItem | ||||
|
r67 | QRectF boundingRect() const; | ||
|
r108 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | ||
|
r131 | QPainterPath shape() const; | ||
|
r139 | |||
void setPen(const QPen& pen); | ||||
|
r389 | void setPointsVisible(bool visible); | ||
public slots: | ||||
void handlePointAdded(int index); | ||||
void handlePointRemoved(int index); | ||||
void handlePointReplaced(int index); | ||||
|
r392 | void handleUpdated(); | ||
|
r439 | void handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY); | ||
|
r389 | void handleGeometryChanged(const QRectF& size); | ||
|
r21 | |||
|
r391 | public: | ||
virtual void updateItem(QVector<QPointF>& oldPoints,QVector<QPointF>& newPoints); | ||||
virtual void updateItem(QVector<QPointF>& oldPoints,int index,QPointF& newPoint); | ||||
|
r419 | virtual void applyGeometry(QVector<QPointF>& points); | ||
|
r391 | void createPoints(int count); | ||
void clearPoints(int count); | ||||
QPointF calculateGeometryPoint(int index) const; | ||||
QVector<QPointF> calculateGeometryPoints() const; | ||||
|
r21 | |||
|
r419 | protected: | ||
|
r439 | qreal m_minX; | ||
qreal m_maxX; | ||||
qreal m_minY; | ||||
qreal m_maxY; | ||||
|
r131 | QPainterPath m_path; | ||
QRectF m_rect; | ||||
|
r419 | QLineSeries* m_series; | ||
|
r439 | QSizeF m_size; | ||
|
r150 | QRectF m_clipRect; | ||
|
r391 | QGraphicsItemGroup m_items; | ||
|
r389 | QVector<QPointF> m_points; | ||
|
r139 | QPen m_pen; | ||
|
r131 | |||
|
r21 | }; | ||
|
r30 | QTCOMMERCIALCHART_END_NAMESPACE | ||
|
r21 | |||
#endif | ||||