@@ -1,152 +1,168 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "areachartitem_p.h" |
|
21 | #include "areachartitem_p.h" | |
22 | #include "qareaseries.h" |
|
22 | #include "qareaseries.h" | |
23 | #include "qareaseries_p.h" |
|
23 | #include "qareaseries_p.h" | |
24 | #include "qlineseries.h" |
|
24 | #include "qlineseries.h" | |
25 | #include "chartpresenter_p.h" |
|
25 | #include "chartpresenter_p.h" | |
26 | #include "domain_p.h" |
|
26 | #include "domain_p.h" | |
27 | #include <QPainter> |
|
27 | #include <QPainter> | |
28 | #include <QGraphicsSceneMouseEvent> |
|
28 | #include <QGraphicsSceneMouseEvent> | |
29 | #include <QDebug> |
|
29 | #include <QDebug> | |
30 |
|
30 | |||
31 |
|
31 | |||
32 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
32 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
33 |
|
33 | |||
34 | //TODO: optimize : remove points which are not visible |
|
34 | //TODO: optimize : remove points which are not visible | |
35 |
|
35 | |||
36 | AreaChartItem::AreaChartItem(QAreaSeries *areaSeries, ChartPresenter *presenter) |
|
36 | AreaChartItem::AreaChartItem(QAreaSeries *areaSeries, ChartPresenter *presenter) | |
37 | : ChartItem(presenter), |
|
37 | : ChartItem(presenter), | |
38 | m_series(areaSeries), |
|
38 | m_series(areaSeries), | |
39 | m_upper(0), |
|
39 | m_upper(0), | |
40 | m_lower(0), |
|
40 | m_lower(0), | |
41 | m_pointsVisible(false) |
|
41 | m_pointsVisible(false) | |
42 | { |
|
42 | { | |
|
43 | setAcceptHoverEvents(true); | |||
43 | setZValue(ChartPresenter::LineChartZValue); |
|
44 | setZValue(ChartPresenter::LineChartZValue); | |
44 | m_upper = new AreaBoundItem(this, m_series->upperSeries(), presenter); |
|
45 | m_upper = new AreaBoundItem(this, m_series->upperSeries(), presenter); | |
45 | if (m_series->lowerSeries()) |
|
46 | if (m_series->lowerSeries()) | |
46 | m_lower = new AreaBoundItem(this, m_series->lowerSeries(), presenter); |
|
47 | m_lower = new AreaBoundItem(this, m_series->lowerSeries(), presenter); | |
47 |
|
48 | |||
48 | QObject::connect(m_series->d_func(), SIGNAL(updated()), this, SLOT(handleUpdated())); |
|
49 | QObject::connect(m_series->d_func(), SIGNAL(updated()), this, SLOT(handleUpdated())); | |
49 | QObject::connect(m_series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated())); |
|
50 | QObject::connect(m_series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated())); | |
50 | QObject::connect(m_series, SIGNAL(opacityChanged()), this, SLOT(handleUpdated())); |
|
51 | QObject::connect(m_series, SIGNAL(opacityChanged()), this, SLOT(handleUpdated())); | |
51 | QObject::connect(this, SIGNAL(clicked(QPointF)), areaSeries, SIGNAL(clicked(QPointF))); |
|
52 | QObject::connect(this, SIGNAL(clicked(QPointF)), areaSeries, SIGNAL(clicked(QPointF))); | |
|
53 | QObject::connect(this, SIGNAL(hovered(QPointF,bool)), areaSeries, SIGNAL(hovered(QPointF,bool))); | |||
52 |
|
54 | |||
53 | handleUpdated(); |
|
55 | handleUpdated(); | |
54 | } |
|
56 | } | |
55 |
|
57 | |||
56 | AreaChartItem::~AreaChartItem() |
|
58 | AreaChartItem::~AreaChartItem() | |
57 | { |
|
59 | { | |
58 | delete m_upper; |
|
60 | delete m_upper; | |
59 | delete m_lower; |
|
61 | delete m_lower; | |
60 | } |
|
62 | } | |
61 |
|
63 | |||
62 | QRectF AreaChartItem::boundingRect() const |
|
64 | QRectF AreaChartItem::boundingRect() const | |
63 | { |
|
65 | { | |
64 | return m_rect; |
|
66 | return m_rect; | |
65 | } |
|
67 | } | |
66 |
|
68 | |||
67 | QPainterPath AreaChartItem::shape() const |
|
69 | QPainterPath AreaChartItem::shape() const | |
68 | { |
|
70 | { | |
69 | return m_path; |
|
71 | return m_path; | |
70 | } |
|
72 | } | |
71 |
|
73 | |||
72 | void AreaChartItem::updatePath() |
|
74 | void AreaChartItem::updatePath() | |
73 | { |
|
75 | { | |
74 | QPainterPath path; |
|
76 | QPainterPath path; | |
75 |
|
77 | |||
76 | path = m_upper->path(); |
|
78 | path = m_upper->path(); | |
77 |
|
79 | |||
78 | if (m_lower) { |
|
80 | if (m_lower) { | |
79 | path.connectPath(m_lower->path().toReversed()); |
|
81 | path.connectPath(m_lower->path().toReversed()); | |
80 | } else { |
|
82 | } else { | |
81 | QPointF first = path.pointAtPercent(0); |
|
83 | QPointF first = path.pointAtPercent(0); | |
82 | QPointF last = path.pointAtPercent(1); |
|
84 | QPointF last = path.pointAtPercent(1); | |
83 | path.lineTo(last.x(), m_clipRect.bottom()); |
|
85 | path.lineTo(last.x(), m_clipRect.bottom()); | |
84 | path.lineTo(first.x(), m_clipRect.bottom()); |
|
86 | path.lineTo(first.x(), m_clipRect.bottom()); | |
85 | } |
|
87 | } | |
86 | path.closeSubpath(); |
|
88 | path.closeSubpath(); | |
87 | prepareGeometryChange(); |
|
89 | prepareGeometryChange(); | |
88 | m_path = path; |
|
90 | m_path = path; | |
89 | m_rect = path.boundingRect(); |
|
91 | m_rect = path.boundingRect(); | |
90 | update(); |
|
92 | update(); | |
91 | } |
|
93 | } | |
92 |
|
94 | |||
93 | void AreaChartItem::handleUpdated() |
|
95 | void AreaChartItem::handleUpdated() | |
94 | { |
|
96 | { | |
95 | setVisible(m_series->isVisible()); |
|
97 | setVisible(m_series->isVisible()); | |
96 | m_pointsVisible = m_series->pointsVisible(); |
|
98 | m_pointsVisible = m_series->pointsVisible(); | |
97 | m_linePen = m_series->pen(); |
|
99 | m_linePen = m_series->pen(); | |
98 | m_brush = m_series->brush(); |
|
100 | m_brush = m_series->brush(); | |
99 | m_pointPen = m_series->pen(); |
|
101 | m_pointPen = m_series->pen(); | |
100 | m_pointPen.setWidthF(2 * m_pointPen.width()); |
|
102 | m_pointPen.setWidthF(2 * m_pointPen.width()); | |
101 | setOpacity(m_series->opacity()); |
|
103 | setOpacity(m_series->opacity()); | |
102 |
|
104 | |||
103 | update(); |
|
105 | update(); | |
104 | } |
|
106 | } | |
105 |
|
107 | |||
106 | void AreaChartItem::handleDomainUpdated() |
|
108 | void AreaChartItem::handleDomainUpdated() | |
107 | { |
|
109 | { | |
108 | m_upper->setDomain(domain()); |
|
110 | m_upper->setDomain(domain()); | |
109 | m_upper->handleDomainUpdated(); |
|
111 | m_upper->handleDomainUpdated(); | |
110 | if (m_lower) { |
|
112 | if (m_lower) { | |
111 | m_lower->setDomain(domain()); |
|
113 | m_lower->setDomain(domain()); | |
112 | m_lower->handleDomainUpdated(); |
|
114 | m_lower->handleDomainUpdated(); | |
113 | } |
|
115 | } | |
114 | } |
|
116 | } | |
115 |
|
117 | |||
116 | void AreaChartItem::handleGeometryChanged(const QRectF &rect) |
|
118 | void AreaChartItem::handleGeometryChanged(const QRectF &rect) | |
117 | { |
|
119 | { | |
118 | m_clipRect = rect.translated(-rect.topLeft()); |
|
120 | m_clipRect = rect.translated(-rect.topLeft()); | |
119 | setPos(rect.topLeft()); |
|
121 | setPos(rect.topLeft()); | |
120 | m_upper->handleGeometryChanged(rect); |
|
122 | m_upper->handleGeometryChanged(rect); | |
121 | if (m_lower) |
|
123 | if (m_lower) | |
122 | m_lower->handleGeometryChanged(rect); |
|
124 | m_lower->handleGeometryChanged(rect); | |
123 | } |
|
125 | } | |
124 |
|
126 | |||
125 | void AreaChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
|
127 | void AreaChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) | |
126 | { |
|
128 | { | |
127 | Q_UNUSED(widget) |
|
129 | Q_UNUSED(widget) | |
128 | Q_UNUSED(option) |
|
130 | Q_UNUSED(option) | |
129 |
|
131 | |||
130 | painter->save(); |
|
132 | painter->save(); | |
131 | painter->setPen(m_linePen); |
|
133 | painter->setPen(m_linePen); | |
132 | painter->setBrush(m_brush); |
|
134 | painter->setBrush(m_brush); | |
133 | painter->setClipRect(m_clipRect); |
|
135 | painter->setClipRect(m_clipRect); | |
134 | painter->drawPath(m_path); |
|
136 | painter->drawPath(m_path); | |
135 | if (m_pointsVisible) { |
|
137 | if (m_pointsVisible) { | |
136 | painter->setPen(m_pointPen); |
|
138 | painter->setPen(m_pointPen); | |
137 | painter->drawPoints(m_upper->geometryPoints()); |
|
139 | painter->drawPoints(m_upper->geometryPoints()); | |
138 | if (m_lower) |
|
140 | if (m_lower) | |
139 | painter->drawPoints(m_lower->geometryPoints()); |
|
141 | painter->drawPoints(m_lower->geometryPoints()); | |
140 | } |
|
142 | } | |
141 | painter->restore(); |
|
143 | painter->restore(); | |
142 | } |
|
144 | } | |
143 |
|
145 | |||
144 | void AreaChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event) |
|
146 | void AreaChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event) | |
145 | { |
|
147 | { | |
146 | emit clicked(m_upper->calculateDomainPoint(event->pos())); |
|
148 | emit clicked(m_upper->calculateDomainPoint(event->pos())); | |
147 | ChartItem::mousePressEvent(event); |
|
149 | ChartItem::mousePressEvent(event); | |
148 | } |
|
150 | } | |
149 |
|
151 | |||
|
152 | void AreaChartItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event) | |||
|
153 | { | |||
|
154 | emit hovered(m_upper->calculateDomainPoint(event->pos()), true); | |||
|
155 | event->accept(); | |||
|
156 | // QGraphicsItem::hoverEnterEvent(event); | |||
|
157 | } | |||
|
158 | ||||
|
159 | void AreaChartItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) | |||
|
160 | { | |||
|
161 | emit hovered(m_upper->calculateDomainPoint(event->pos()), false); | |||
|
162 | event->accept(); | |||
|
163 | // QGraphicsItem::hoverEnterEvent(event); | |||
|
164 | } | |||
|
165 | ||||
150 | #include "moc_areachartitem_p.cpp" |
|
166 | #include "moc_areachartitem_p.cpp" | |
151 |
|
167 | |||
152 | QTCOMMERCIALCHART_END_NAMESPACE |
|
168 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,106 +1,109 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | // W A R N I N G |
|
21 | // W A R N I N G | |
22 | // ------------- |
|
22 | // ------------- | |
23 | // |
|
23 | // | |
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
25 | // implementation detail. This header file may change from version to |
|
25 | // implementation detail. This header file may change from version to | |
26 | // version without notice, or even be removed. |
|
26 | // version without notice, or even be removed. | |
27 | // |
|
27 | // | |
28 | // We mean it. |
|
28 | // We mean it. | |
29 |
|
29 | |||
30 | #ifndef AREACHARTITEM_H |
|
30 | #ifndef AREACHARTITEM_H | |
31 | #define AREACHARTITEM_H |
|
31 | #define AREACHARTITEM_H | |
32 |
|
32 | |||
33 | #include "qchartglobal.h" |
|
33 | #include "qchartglobal.h" | |
34 | #include "linechartitem_p.h" |
|
34 | #include "linechartitem_p.h" | |
35 | #include <QPen> |
|
35 | #include <QPen> | |
36 |
|
36 | |||
37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
38 |
|
38 | |||
39 | class QAreaSeries; |
|
39 | class QAreaSeries; | |
40 | class AreaChartItem; |
|
40 | class AreaChartItem; | |
41 |
|
41 | |||
42 | class AreaChartItem : public ChartItem |
|
42 | class AreaChartItem : public ChartItem | |
43 | { |
|
43 | { | |
44 | Q_OBJECT |
|
44 | Q_OBJECT | |
45 | public: |
|
45 | public: | |
46 | AreaChartItem(QAreaSeries *areaSeries, ChartPresenter *presenter); |
|
46 | AreaChartItem(QAreaSeries *areaSeries, ChartPresenter *presenter); | |
47 | ~AreaChartItem(); |
|
47 | ~AreaChartItem(); | |
48 |
|
48 | |||
49 | //from QGraphicsItem |
|
49 | //from QGraphicsItem | |
50 | QRectF boundingRect() const; |
|
50 | QRectF boundingRect() const; | |
51 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); |
|
51 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | |
52 | QPainterPath shape() const; |
|
52 | QPainterPath shape() const; | |
53 |
|
53 | |||
54 | LineChartItem *upperLineItem() const { return m_upper; } |
|
54 | LineChartItem *upperLineItem() const { return m_upper; } | |
55 | LineChartItem *lowerLineItem() const { return m_lower; } |
|
55 | LineChartItem *lowerLineItem() const { return m_lower; } | |
56 |
|
56 | |||
57 | void updatePath(); |
|
57 | void updatePath(); | |
58 |
|
58 | |||
59 | protected: |
|
59 | protected: | |
60 | void mousePressEvent(QGraphicsSceneMouseEvent *event); |
|
60 | void mousePressEvent(QGraphicsSceneMouseEvent *event); | |
|
61 | void hoverEnterEvent(QGraphicsSceneHoverEvent *event); | |||
|
62 | void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); | |||
61 |
|
63 | |||
62 | Q_SIGNALS: |
|
64 | Q_SIGNALS: | |
63 | void clicked(const QPointF &point); |
|
65 | void clicked(const QPointF &point); | |
|
66 | void hovered(const QPointF &point, bool state); | |||
64 |
|
67 | |||
65 | public Q_SLOTS: |
|
68 | public Q_SLOTS: | |
66 | void handleUpdated(); |
|
69 | void handleUpdated(); | |
67 | void handleDomainUpdated(); |
|
70 | void handleDomainUpdated(); | |
68 | void handleGeometryChanged(const QRectF &size); |
|
71 | void handleGeometryChanged(const QRectF &size); | |
69 |
|
72 | |||
70 | private: |
|
73 | private: | |
71 | QAreaSeries *m_series; |
|
74 | QAreaSeries *m_series; | |
72 | LineChartItem *m_upper; |
|
75 | LineChartItem *m_upper; | |
73 | LineChartItem *m_lower; |
|
76 | LineChartItem *m_lower; | |
74 | QPainterPath m_path; |
|
77 | QPainterPath m_path; | |
75 | QRectF m_rect; |
|
78 | QRectF m_rect; | |
76 | QRectF m_clipRect; |
|
79 | QRectF m_clipRect; | |
77 | QPen m_linePen; |
|
80 | QPen m_linePen; | |
78 | QPen m_pointPen; |
|
81 | QPen m_pointPen; | |
79 | QBrush m_brush; |
|
82 | QBrush m_brush; | |
80 | bool m_pointsVisible; |
|
83 | bool m_pointsVisible; | |
81 |
|
84 | |||
82 | }; |
|
85 | }; | |
83 |
|
86 | |||
84 | class AreaBoundItem : public LineChartItem |
|
87 | class AreaBoundItem : public LineChartItem | |
85 | { |
|
88 | { | |
86 | public: |
|
89 | public: | |
87 | AreaBoundItem(AreaChartItem *item, QLineSeries *lineSeries, ChartPresenter *presenter) |
|
90 | AreaBoundItem(AreaChartItem *item, QLineSeries *lineSeries, ChartPresenter *presenter) | |
88 | : LineChartItem(lineSeries, 0), m_item(item) |
|
91 | : LineChartItem(lineSeries, 0), m_item(item) | |
89 | { |
|
92 | { | |
90 | setPresenter(presenter); |
|
93 | setPresenter(presenter); | |
91 | } |
|
94 | } | |
92 | ~AreaBoundItem() {} |
|
95 | ~AreaBoundItem() {} | |
93 |
|
96 | |||
94 | void updateGeometry() |
|
97 | void updateGeometry() | |
95 | { |
|
98 | { | |
96 | LineChartItem::updateGeometry(); |
|
99 | LineChartItem::updateGeometry(); | |
97 | m_item->updatePath(); |
|
100 | m_item->updatePath(); | |
98 | } |
|
101 | } | |
99 |
|
102 | |||
100 | private: |
|
103 | private: | |
101 | AreaChartItem *m_item; |
|
104 | AreaChartItem *m_item; | |
102 | }; |
|
105 | }; | |
103 |
|
106 | |||
104 | QTCOMMERCIALCHART_END_NAMESPACE |
|
107 | QTCOMMERCIALCHART_END_NAMESPACE | |
105 |
|
108 | |||
106 | #endif |
|
109 | #endif |
@@ -1,85 +1,86 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #ifndef QAREASERIES_H |
|
21 | #ifndef QAREASERIES_H | |
22 | #define QAREASERIES_H |
|
22 | #define QAREASERIES_H | |
23 |
|
23 | |||
24 | #include <qchartglobal.h> |
|
24 | #include <qchartglobal.h> | |
25 | #include <qabstractseries.h> |
|
25 | #include <qabstractseries.h> | |
26 | #include <QPen> |
|
26 | #include <QPen> | |
27 | #include <QBrush> |
|
27 | #include <QBrush> | |
28 |
|
28 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 | class QLineSeries; |
|
30 | class QLineSeries; | |
31 | class QAreaSeriesPrivate; |
|
31 | class QAreaSeriesPrivate; | |
32 |
|
32 | |||
33 | class QTCOMMERCIALCHART_EXPORT QAreaSeries : public QAbstractSeries |
|
33 | class QTCOMMERCIALCHART_EXPORT QAreaSeries : public QAbstractSeries | |
34 | { |
|
34 | { | |
35 | Q_OBJECT |
|
35 | Q_OBJECT | |
36 | Q_PROPERTY(QLineSeries *upperSeries READ upperSeries) |
|
36 | Q_PROPERTY(QLineSeries *upperSeries READ upperSeries) | |
37 | Q_PROPERTY(QLineSeries *lowerSeries READ lowerSeries) |
|
37 | Q_PROPERTY(QLineSeries *lowerSeries READ lowerSeries) | |
38 | Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) |
|
38 | Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) | |
39 | Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged) |
|
39 | Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged) | |
40 |
|
40 | |||
41 | public: |
|
41 | public: | |
42 | explicit QAreaSeries(QObject *parent = 0); |
|
42 | explicit QAreaSeries(QObject *parent = 0); | |
43 | explicit QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries = 0); |
|
43 | explicit QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries = 0); | |
44 | ~QAreaSeries(); |
|
44 | ~QAreaSeries(); | |
45 |
|
45 | |||
46 | public: |
|
46 | public: | |
47 | QAbstractSeries::SeriesType type() const; |
|
47 | QAbstractSeries::SeriesType type() const; | |
48 |
|
48 | |||
49 | void setUpperSeries(QLineSeries *series); |
|
49 | void setUpperSeries(QLineSeries *series); | |
50 | QLineSeries *upperSeries() const; |
|
50 | QLineSeries *upperSeries() const; | |
51 | void setLowerSeries(QLineSeries *series); |
|
51 | void setLowerSeries(QLineSeries *series); | |
52 | QLineSeries *lowerSeries() const; |
|
52 | QLineSeries *lowerSeries() const; | |
53 |
|
53 | |||
54 | void setPen(const QPen &pen); |
|
54 | void setPen(const QPen &pen); | |
55 | QPen pen() const; |
|
55 | QPen pen() const; | |
56 |
|
56 | |||
57 | void setBrush(const QBrush &brush); |
|
57 | void setBrush(const QBrush &brush); | |
58 | QBrush brush() const; |
|
58 | QBrush brush() const; | |
59 |
|
59 | |||
60 | void setColor(const QColor &color); |
|
60 | void setColor(const QColor &color); | |
61 | QColor color() const; |
|
61 | QColor color() const; | |
62 |
|
62 | |||
63 | void setBorderColor(const QColor &color); |
|
63 | void setBorderColor(const QColor &color); | |
64 | QColor borderColor() const; |
|
64 | QColor borderColor() const; | |
65 |
|
65 | |||
66 | void setPointsVisible(bool visible = true); |
|
66 | void setPointsVisible(bool visible = true); | |
67 | bool pointsVisible() const; |
|
67 | bool pointsVisible() const; | |
68 |
|
68 | |||
69 | Q_SIGNALS: |
|
69 | Q_SIGNALS: | |
70 | void clicked(const QPointF &point); |
|
70 | void clicked(const QPointF &point); | |
|
71 | void hovered(const QPointF &point, bool state); | |||
71 | void selected(); |
|
72 | void selected(); | |
72 | void colorChanged(QColor color); |
|
73 | void colorChanged(QColor color); | |
73 | void borderColorChanged(QColor color); |
|
74 | void borderColorChanged(QColor color); | |
74 |
|
75 | |||
75 | private: |
|
76 | private: | |
76 | Q_DECLARE_PRIVATE(QAreaSeries) |
|
77 | Q_DECLARE_PRIVATE(QAreaSeries) | |
77 | Q_DISABLE_COPY(QAreaSeries) |
|
78 | Q_DISABLE_COPY(QAreaSeries) | |
78 | friend class AreaLegendMarker; |
|
79 | friend class AreaLegendMarker; | |
79 | friend class AreaChartItem; |
|
80 | friend class AreaChartItem; | |
80 | friend class QAreaLegendMarkerPrivate; |
|
81 | friend class QAreaLegendMarkerPrivate; | |
81 | }; |
|
82 | }; | |
82 |
|
83 | |||
83 | QTCOMMERCIALCHART_END_NAMESPACE |
|
84 | QTCOMMERCIALCHART_END_NAMESPACE | |
84 |
|
85 | |||
85 | #endif // QAREASERIES_H |
|
86 | #endif // QAREASERIES_H |
General Comments 0
You need to be logged in to leave comments.
Login now