areachartitem_p.h
75 lines
| 1.6 KiB
| text/x-c
|
CLexer
Michal Klocek
|
r421 | #ifndef AREACHARTITEM_H | ||
#define AREACHARTITEM_H | ||||
#include "qchartglobal.h" | ||||
#include "linechartitem_p.h" | ||||
#include <QPen> | ||||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
class QAreaSeries; | ||||
class AreaChartItem; | ||||
class AreaChartItem : public QObject ,public ChartItem | ||||
{ | ||||
Q_OBJECT | ||||
public: | ||||
Michal Klocek
|
r439 | AreaChartItem(QAreaSeries* areaSeries, QGraphicsItem *parent = 0); | ||
Michal Klocek
|
r421 | ~ AreaChartItem(); | ||
//from QGraphicsItem | ||||
QRectF boundingRect() const; | ||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | ||||
QPainterPath shape() const; | ||||
Michal Klocek
|
r560 | LineChartItem* upperLineItem() const { return m_upper ;} | ||
LineChartItem* lowerLineItem() const { return m_lower ;} | ||||
Michal Klocek
|
r421 | void updatePath(); | ||
Michal Klocek
|
r571 | |||
protected: | ||||
void mousePressEvent( QGraphicsSceneMouseEvent * event ); | ||||
signals: | ||||
void clicked(const QPointF& point); | ||||
Michal Klocek
|
r421 | public slots: | ||
void handleUpdated(); | ||||
Michal Klocek
|
r439 | void handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY); | ||
Michal Klocek
|
r421 | void handleGeometryChanged(const QRectF& size); | ||
private: | ||||
QAreaSeries* m_series; | ||||
LineChartItem* m_upper; | ||||
LineChartItem* m_lower; | ||||
Michal Klocek
|
r439 | QPainterPath m_path; | ||
Michal Klocek
|
r421 | QRectF m_rect; | ||
QRectF m_clipRect; | ||||
Michal Klocek
|
r563 | QPen m_linePen; | ||
QPen m_pointPen; | ||||
Michal Klocek
|
r421 | QBrush m_brush; | ||
Michal Klocek
|
r563 | bool m_pointsVisible; | ||
Michal Klocek
|
r421 | }; | ||
class AreaBoundItem : public LineChartItem | ||||
{ | ||||
public: | ||||
Michal Klocek
|
r439 | AreaBoundItem(AreaChartItem* item,QLineSeries* lineSeries):LineChartItem(lineSeries), | ||
Michal Klocek
|
r421 | m_item(item){}; | ||
~AreaBoundItem(){}; | ||||
Michal Klocek
|
r557 | void setLayout(QVector<QPointF>& points){ | ||
LineChartItem::setLayout(points); | ||||
Michal Klocek
|
r421 | m_item->updatePath(); | ||
} | ||||
private: | ||||
AreaChartItem* m_item; | ||||
}; | ||||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif | ||||