@@ -10,7 +10,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
10 | 10 | |
|
11 | 11 | //TODO: optimize : remove points which are not visible |
|
12 | 12 | |
|
13 |
AreaChartItem::AreaChartItem(QAreaSeries *areaSeries,ChartPresenter *presenter) |
|
|
13 | AreaChartItem::AreaChartItem(QAreaSeries *areaSeries, ChartPresenter *presenter) | |
|
14 | : ChartItem(presenter), | |
|
14 | 15 | m_series(areaSeries), |
|
15 | 16 | m_upper(0), |
|
16 | 17 | m_lower(0), |
@@ -18,9 +19,8 AreaChartItem::AreaChartItem(QAreaSeries *areaSeries,ChartPresenter *presenter) | |||
|
18 | 19 | { |
|
19 | 20 | setZValue(ChartPresenter::LineChartZValue); |
|
20 | 21 | m_upper = new AreaBoundItem(this,m_series->upperSeries()); |
|
21 |
if (m_series->lowerSeries()) |
|
|
22 | if (m_series->lowerSeries()) | |
|
22 | 23 | m_lower = new AreaBoundItem(this,m_series->lowerSeries()); |
|
23 | } | |
|
24 | 24 | |
|
25 | 25 | connect(areaSeries,SIGNAL(updated()),this,SLOT(handleUpdated())); |
|
26 | 26 | connect(this,SIGNAL(clicked(const QPointF&)),areaSeries,SIGNAL(clicked(const QPointF&))); |
@@ -32,7 +32,7 AreaChartItem::~AreaChartItem() | |||
|
32 | 32 | { |
|
33 | 33 | delete m_upper; |
|
34 | 34 | delete m_lower; |
|
35 |
} |
|
|
35 | } | |
|
36 | 36 | |
|
37 | 37 | QRectF AreaChartItem::boundingRect() const |
|
38 | 38 | { |
@@ -60,8 +60,8 void AreaChartItem::updatePath() | |||
|
60 | 60 | } |
|
61 | 61 | path.closeSubpath(); |
|
62 | 62 | prepareGeometryChange(); |
|
63 | m_path=path; | |
|
64 | m_rect=path.boundingRect(); | |
|
63 | m_path = path; | |
|
64 | m_rect = path.boundingRect(); | |
|
65 | 65 | update(); |
|
66 | 66 | } |
|
67 | 67 | |
@@ -71,7 +71,7 void AreaChartItem::handleUpdated() | |||
|
71 | 71 | m_linePen = m_series->pen(); |
|
72 | 72 | m_brush = m_series->brush(); |
|
73 | 73 | m_pointPen = m_series->pen(); |
|
74 | m_pointPen.setWidthF(2*m_pointPen.width()); | |
|
74 | m_pointPen.setWidthF(2 * m_pointPen.width()); | |
|
75 | 75 | |
|
76 | 76 | update(); |
|
77 | 77 | } |
@@ -91,7 +91,6 void AreaChartItem::handleGeometryChanged(const QRectF &rect) | |||
|
91 | 91 | if (m_lower) |
|
92 | 92 | m_lower->handleGeometryChanged(rect); |
|
93 | 93 | } |
|
94 | //painter | |
|
95 | 94 | |
|
96 | 95 | void AreaChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
|
97 | 96 | { |
@@ -15,7 +15,7 class AreaChartItem : public ChartItem | |||
|
15 | 15 | Q_OBJECT |
|
16 | 16 | public: |
|
17 | 17 | AreaChartItem(QAreaSeries *areaSeries, ChartPresenter *presenter); |
|
18 |
~ |
|
|
18 | ~AreaChartItem(); | |
|
19 | 19 | |
|
20 | 20 | //from QGraphicsItem |
|
21 | 21 | QRectF boundingRect() const; |
@@ -56,7 +56,7 class AreaBoundItem : public LineChartItem | |||
|
56 | 56 | { |
|
57 | 57 | public: |
|
58 | 58 | AreaBoundItem(AreaChartItem *item,QLineSeries *lineSeries) : LineChartItem(lineSeries, 0), m_item(item) {} |
|
59 | ~AreaBoundItem(){} | |
|
59 | ~AreaBoundItem() {} | |
|
60 | 60 | |
|
61 | 61 | void setLayout(QVector<QPointF> &points) { |
|
62 | 62 | LineChartItem::setLayout(points); |
@@ -65,7 +65,6 public: | |||
|
65 | 65 | |
|
66 | 66 | private: |
|
67 | 67 | AreaChartItem* m_item; |
|
68 | ||
|
69 | 68 | }; |
|
70 | 69 | |
|
71 | 70 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -78,12 +78,14 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
78 | 78 | upperSeries line and \a lowerSeries line. If no \a lowerSeries is passed to constructor, area is specified by axis x (y=0) instead. |
|
79 | 79 | When series object is added to QChartView or QChart instance ownerships is transfered. |
|
80 | 80 | */ |
|
81 |
QAreaSeries::QAreaSeries(QLineSeries* |
|
|
82 |
|
|
|
83 |
|
|
|
84 | m_pointsVisible(false) | |
|
81 | QAreaSeries::QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries) | |
|
82 | : QSeries(upperSeries), | |
|
83 | m_upperSeries(upperSeries), | |
|
84 | m_lowerSeries(lowerSeries), | |
|
85 | m_pointsVisible(false) | |
|
85 | 86 | { |
|
86 | 87 | } |
|
88 | ||
|
87 | 89 | /*! |
|
88 | 90 | Destroys the object. Series added to QChartView or QChart instances are owned by those, |
|
89 | 91 | and are deleted when mentioned object are destroyed. |
@@ -95,7 +97,7 QAreaSeries::~QAreaSeries() | |||
|
95 | 97 | /*! |
|
96 | 98 | Sets \a pen used for drawing area outline. |
|
97 | 99 | */ |
|
98 |
void QAreaSeries::setPen(const QPen& |
|
|
100 | void QAreaSeries::setPen(const QPen &pen) | |
|
99 | 101 | { |
|
100 | 102 | if (m_pen != pen) { |
|
101 | 103 | m_pen = pen; |
@@ -12,7 +12,7 class QTCOMMERCIALCHART_EXPORT QXYSeries : public QSeries | |||
|
12 | 12 | { |
|
13 | 13 | Q_OBJECT |
|
14 | 14 | protected: |
|
15 | QXYSeries(QObject *parent=0); | |
|
15 | QXYSeries(QObject *parent = 0); | |
|
16 | 16 | virtual ~QXYSeries(); |
|
17 | 17 | |
|
18 | 18 | public: |
@@ -36,21 +36,21 public: | |||
|
36 | 36 | |
|
37 | 37 | void setPen(const QPen &pen); |
|
38 | 38 | QPen pen() const {return m_pen;} |
|
39 |
void setBrush(const QBrush & |
|
|
39 | void setBrush(const QBrush &brush); | |
|
40 | 40 | QBrush brush() const {return m_brush;} |
|
41 | 41 | |
|
42 | 42 | bool setModel(QAbstractItemModel *model); |
|
43 | QAbstractItemModel* model() {return m_model;} | |
|
43 | QAbstractItemModel* model() { return m_model; } | |
|
44 | 44 | |
|
45 | 45 | virtual void setModelMapping(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical); |
|
46 | 46 | virtual void setModelMappingShift(int first, int count = 0); |
|
47 | 47 | |
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
|
51 |
|
|
|
52 |
|
|
|
53 |
|
|
|
48 | private slots: | |
|
49 | void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight); | |
|
50 | void modelDataAboutToBeAdded(QModelIndex parent, int start, int end); | |
|
51 | void modelDataAdded(QModelIndex parent, int start, int end); | |
|
52 | void modelDataAboutToBeRemoved(QModelIndex parent, int start, int end); | |
|
53 | void modelDataRemoved(QModelIndex parent, int start, int end); | |
|
54 | 54 | |
|
55 | 55 | signals: |
|
56 | 56 | void clicked(const QPointF &point); |
General Comments 0
You need to be logged in to leave comments.
Login now