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