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