@@ -1,199 +1,206 | |||||
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 "qabstractseries.h" |
|
21 | #include "qabstractseries.h" | |
22 | #include "qabstractseries_p.h" |
|
22 | #include "qabstractseries_p.h" | |
23 | #include "chartdataset_p.h" |
|
23 | #include "chartdataset_p.h" | |
24 |
|
24 | |||
25 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
25 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
26 |
|
26 | |||
27 | /*! |
|
27 | /*! | |
28 | \class QAbstractSeries |
|
28 | \class QAbstractSeries | |
29 | \brief Base class for all QtCommercial Chart series. |
|
29 | \brief Base class for all QtCommercial Chart series. | |
30 | \mainclass |
|
30 | \mainclass | |
31 |
|
31 | |||
32 | Usually you use the series type specific inherited classes instead of the base class. |
|
32 | Usually you use the series type specific inherited classes instead of the base class. | |
33 | \sa QXYSeries, QLineSeries, QSplineSeries, QScatterSeries, QAreaSeries, QAbstractBarSeries, QStackedBarSeries, |
|
33 | \sa QXYSeries, QLineSeries, QSplineSeries, QScatterSeries, QAreaSeries, QAbstractBarSeries, QStackedBarSeries, | |
34 | QPercentBarSeries, QPieSeries |
|
34 | QPercentBarSeries, QPieSeries | |
35 | */ |
|
35 | */ | |
36 | /*! |
|
36 | /*! | |
37 | \qmlclass AbstractSeries |
|
37 | \qmlclass AbstractSeries | |
38 | AbstractSeries is the base class for all series. |
|
38 | AbstractSeries is the base class for all series. | |
39 | The class cannot be instantiated by the user. |
|
39 | The class cannot be instantiated by the user. | |
40 | */ |
|
40 | */ | |
41 |
|
41 | |||
42 | /*! |
|
42 | /*! | |
43 | \enum QAbstractSeries::SeriesType |
|
43 | \enum QAbstractSeries::SeriesType | |
44 |
|
44 | |||
45 | The type of the series object. |
|
45 | The type of the series object. | |
46 |
|
46 | |||
47 | \value SeriesTypeLine |
|
47 | \value SeriesTypeLine | |
48 | \value SeriesTypeArea |
|
48 | \value SeriesTypeArea | |
49 | \value SeriesTypeBar |
|
49 | \value SeriesTypeBar | |
50 | \value SeriesTypeStackedBar |
|
50 | \value SeriesTypeStackedBar | |
51 | \value SeriesTypePercentBar |
|
51 | \value SeriesTypePercentBar | |
52 | \value SeriesTypePie |
|
52 | \value SeriesTypePie | |
53 | \value SeriesTypeScatter |
|
53 | \value SeriesTypeScatter | |
54 | \value SeriesTypeSpline |
|
54 | \value SeriesTypeSpline | |
55 | */ |
|
55 | */ | |
56 |
|
56 | |||
57 | /*! |
|
57 | /*! | |
58 | \property QAbstractSeries::type |
|
58 | \property QAbstractSeries::type | |
59 | The type of the series. |
|
59 | The type of the series. | |
60 | */ |
|
60 | */ | |
61 | /*! |
|
61 | /*! | |
62 | \qmlproperty ChartView.SeriesType AbstractSeries::type |
|
62 | \qmlproperty ChartView.SeriesType AbstractSeries::type | |
63 | The type of the series. |
|
63 | The type of the series. | |
64 | */ |
|
64 | */ | |
65 |
|
65 | |||
66 | /*! |
|
66 | /*! | |
67 | \property QAbstractSeries::name |
|
67 | \property QAbstractSeries::name | |
68 | \brief name of the series property. The name is shown in legend for QXYSeries. |
|
68 | \brief name of the series property. The name is shown in legend for QXYSeries. | |
69 | */ |
|
69 | */ | |
70 | /*! |
|
70 | /*! | |
71 | \qmlproperty string AbstractSeries::name |
|
71 | \qmlproperty string AbstractSeries::name | |
72 | Name of the series. The name is shown in legend for QXYSeries. |
|
72 | Name of the series. The name is shown in legend for QXYSeries. | |
73 | */ |
|
73 | */ | |
74 |
|
74 | |||
75 | /*! |
|
75 | /*! | |
76 | \fn void QAbstractSeries::nameChanged() |
|
76 | \fn void QAbstractSeries::nameChanged() | |
77 | This signal is emitted when the series name changes. |
|
77 | This signal is emitted when the series name changes. | |
78 | */ |
|
78 | */ | |
79 | /*! |
|
79 | /*! | |
80 | \qmlsignal AbstractSeries::nameChanged() |
|
80 | \qmlsignal AbstractSeries::onNameChanged() | |
81 | This signal is emitted when the series name changes. |
|
81 | This signal is emitted when the series name changes. | |
82 | */ |
|
82 | */ | |
83 |
|
83 | |||
84 | /*! |
|
84 | /*! | |
85 | \property QAbstractSeries::visible |
|
85 | \property QAbstractSeries::visible | |
86 | \brief whether the series is visible or not; true by default. |
|
86 | \brief whether the series is visible or not; true by default. | |
87 | */ |
|
87 | */ | |
|
88 | /*! | |||
|
89 | \qmlproperty void AbstractSeries::visible | |||
|
90 | Visibility of the series. True by default. | |||
|
91 | */ | |||
88 |
|
92 | |||
89 | /*! |
|
93 | /*! | |
90 | \fn void QAbstractSeries::visibleChanged() |
|
94 | \fn void QAbstractSeries::visibleChanged() | |
91 | Emitted when the series visibility changes. |
|
95 | Emitted when the series visibility changes. | |
92 | */ |
|
96 | */ | |
93 |
|
97 | /*! | ||
|
98 | \qmlsignal AbstractSeries::onVisibleChanged() | |||
|
99 | Emitted when the series visibility changes. | |||
|
100 | */ | |||
94 | /*! |
|
101 | /*! | |
95 | \internal |
|
102 | \internal | |
96 | \brief Constructs ChartSeries object with \a parent. |
|
103 | \brief Constructs ChartSeries object with \a parent. | |
97 | */ |
|
104 | */ | |
98 | QAbstractSeries::QAbstractSeries(QAbstractSeriesPrivate &d, QObject *parent) : |
|
105 | QAbstractSeries::QAbstractSeries(QAbstractSeriesPrivate &d, QObject *parent) : | |
99 | QObject(parent), |
|
106 | QObject(parent), | |
100 | d_ptr(&d) |
|
107 | d_ptr(&d) | |
101 | { |
|
108 | { | |
102 | } |
|
109 | } | |
103 |
|
110 | |||
104 | /*! |
|
111 | /*! | |
105 | \brief Virtual destructor for the chart series. |
|
112 | \brief Virtual destructor for the chart series. | |
106 | */ |
|
113 | */ | |
107 | QAbstractSeries::~QAbstractSeries() |
|
114 | QAbstractSeries::~QAbstractSeries() | |
108 | { |
|
115 | { | |
109 | if(d_ptr->m_dataset) qFatal("Still binded series detected !"); |
|
116 | if(d_ptr->m_dataset) qFatal("Still binded series detected !"); | |
110 | } |
|
117 | } | |
111 |
|
118 | |||
112 | void QAbstractSeries::setName(const QString& name) |
|
119 | void QAbstractSeries::setName(const QString& name) | |
113 | { |
|
120 | { | |
114 | if (name != d_ptr->m_name) { |
|
121 | if (name != d_ptr->m_name) { | |
115 | d_ptr->m_name = name; |
|
122 | d_ptr->m_name = name; | |
116 | emit nameChanged(); |
|
123 | emit nameChanged(); | |
117 | } |
|
124 | } | |
118 | } |
|
125 | } | |
119 |
|
126 | |||
120 | QString QAbstractSeries::name() const |
|
127 | QString QAbstractSeries::name() const | |
121 | { |
|
128 | { | |
122 | return d_ptr->m_name; |
|
129 | return d_ptr->m_name; | |
123 | } |
|
130 | } | |
124 |
|
131 | |||
125 | /*! |
|
132 | /*! | |
126 | Sets the visibility of series to \a visible |
|
133 | Sets the visibility of series to \a visible | |
127 | */ |
|
134 | */ | |
128 | void QAbstractSeries::setVisible(bool visible) |
|
135 | void QAbstractSeries::setVisible(bool visible) | |
129 | { |
|
136 | { | |
130 | if (visible != d_ptr->m_visible) { |
|
137 | if (visible != d_ptr->m_visible) { | |
131 | d_ptr->m_visible = visible; |
|
138 | d_ptr->m_visible = visible; | |
132 | emit visibleChanged(); |
|
139 | emit visibleChanged(); | |
133 | } |
|
140 | } | |
134 | } |
|
141 | } | |
135 |
|
142 | |||
136 | /*! |
|
143 | /*! | |
137 | Returns the visibility of series |
|
144 | Returns the visibility of series | |
138 | */ |
|
145 | */ | |
139 | bool QAbstractSeries::isVisible() const |
|
146 | bool QAbstractSeries::isVisible() const | |
140 | { |
|
147 | { | |
141 | return d_ptr->m_visible; |
|
148 | return d_ptr->m_visible; | |
142 | } |
|
149 | } | |
143 |
|
150 | |||
144 | /*! |
|
151 | /*! | |
145 | \brief Returns the chart where series belongs to. |
|
152 | \brief Returns the chart where series belongs to. | |
146 |
|
153 | |||
147 | Set automatically when the series is added to the chart |
|
154 | Set automatically when the series is added to the chart | |
148 | and unset when the series is removed from the chart. |
|
155 | and unset when the series is removed from the chart. | |
149 | */ |
|
156 | */ | |
150 | QChart* QAbstractSeries::chart() const |
|
157 | QChart* QAbstractSeries::chart() const | |
151 | { |
|
158 | { | |
152 | return d_ptr->m_chart; |
|
159 | return d_ptr->m_chart; | |
153 | } |
|
160 | } | |
154 |
|
161 | |||
155 | //void QAbstractSeries::adjustView() |
|
162 | //void QAbstractSeries::adjustView() | |
156 | //{ |
|
163 | //{ | |
157 | // //TODO: |
|
164 | // //TODO: | |
158 | //} |
|
165 | //} | |
159 |
|
166 | |||
160 | /*! |
|
167 | /*! | |
161 | \brief Sets the visibility of the series to true |
|
168 | \brief Sets the visibility of the series to true | |
162 |
|
169 | |||
163 | \sa setVisible(), isVisible() |
|
170 | \sa setVisible(), isVisible() | |
164 | */ |
|
171 | */ | |
165 | void QAbstractSeries::show() |
|
172 | void QAbstractSeries::show() | |
166 | { |
|
173 | { | |
167 | setVisible(true); |
|
174 | setVisible(true); | |
168 | } |
|
175 | } | |
169 |
|
176 | |||
170 | /*! |
|
177 | /*! | |
171 | \brief Sets the visibility of the series to false |
|
178 | \brief Sets the visibility of the series to false | |
172 |
|
179 | |||
173 | \sa setVisible(), isVisible() |
|
180 | \sa setVisible(), isVisible() | |
174 | */ |
|
181 | */ | |
175 | void QAbstractSeries::hide() |
|
182 | void QAbstractSeries::hide() | |
176 | { |
|
183 | { | |
177 | setVisible(false); |
|
184 | setVisible(false); | |
178 | } |
|
185 | } | |
179 |
|
186 | |||
180 | /////////////////////////////////////////////////////////////////////////////////////////////////// |
|
187 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
181 |
|
188 | |||
182 | QAbstractSeriesPrivate::QAbstractSeriesPrivate(QAbstractSeries* q): |
|
189 | QAbstractSeriesPrivate::QAbstractSeriesPrivate(QAbstractSeries* q): | |
183 | q_ptr(q), |
|
190 | q_ptr(q), | |
184 | m_chart(0), |
|
191 | m_chart(0), | |
185 | m_dataset(0), |
|
192 | m_dataset(0), | |
186 | m_visible(true) |
|
193 | m_visible(true) | |
187 | { |
|
194 | { | |
188 | } |
|
195 | } | |
189 |
|
196 | |||
190 | QAbstractSeriesPrivate::~QAbstractSeriesPrivate() |
|
197 | QAbstractSeriesPrivate::~QAbstractSeriesPrivate() | |
191 | { |
|
198 | { | |
192 | } |
|
199 | } | |
193 |
|
200 | |||
194 | #include "moc_qabstractseries.cpp" |
|
201 | #include "moc_qabstractseries.cpp" | |
195 | #include "moc_qabstractseries_p.cpp" |
|
202 | #include "moc_qabstractseries_p.cpp" | |
196 |
|
203 | |||
197 | QTCOMMERCIALCHART_END_NAMESPACE |
|
204 | QTCOMMERCIALCHART_END_NAMESPACE | |
198 |
|
205 | |||
199 |
|
206 |
General Comments 0
You need to be logged in to leave comments.
Login now