@@ -1,363 +1,363 | |||||
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 "qbarset.h" |
|
21 | #include "qbarset.h" | |
22 | #include "qbarset_p.h" |
|
22 | #include "qbarset_p.h" | |
23 |
|
23 | |||
24 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
24 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
25 |
|
25 | |||
26 | /*! |
|
26 | /*! | |
27 | \class QBarSet |
|
27 | \class QBarSet | |
28 | \brief part of QtCommercial chart API. |
|
28 | \brief part of QtCommercial chart API. | |
29 |
|
29 | |||
30 | QBarSet represents one set of bars. Set of bars contains one data value for each category. |
|
30 | QBarSet represents one set of bars. Set of bars contains one data value for each category. | |
31 | First value of set is assumed to belong to first category, second to second category and so on. |
|
31 | First value of set is assumed to belong to first category, second to second category and so on. | |
32 | If set has fewer values than there are categories, then the missing values are assumed to be |
|
32 | If set has fewer values than there are categories, then the missing values are assumed to be | |
33 | at the end of set. For missing values in middle of a set, numerical value of zero is used. |
|
33 | at the end of set. For missing values in middle of a set, numerical value of zero is used. | |
34 |
|
34 | |||
35 | \mainclass |
|
35 | \mainclass | |
36 |
|
36 | |||
37 | \sa QBarSeries, QGroupedBarSeries, QStackedBarSeries, QPercentBarSeries |
|
37 | \sa QBarSeries, QGroupedBarSeries, QStackedBarSeries, QPercentBarSeries | |
38 | */ |
|
38 | */ | |
39 |
|
39 | |||
40 | /*! |
|
40 | /*! | |
41 | \fn void QBarSet::clicked(QString category) |
|
41 | \fn void QBarSet::clicked(QString category) | |
42 | \brief signals that set has been clicked |
|
42 | \brief signals that set has been clicked | |
43 | Parameter \a category describes on which category was clicked |
|
43 | Parameter \a category describes on which category was clicked | |
44 | */ |
|
44 | */ | |
45 |
|
45 | |||
46 | /*! |
|
46 | /*! | |
47 | \fn void QBarSet::hovered(bool status) |
|
47 | \fn void QBarSet::hovered(bool status) | |
48 | \brief signals that mouse has hovered over the set. If \a status is true, then mouse was entered. If \a status is false, then mouse was left. |
|
48 | \brief signals that mouse has hovered over the set. If \a status is true, then mouse was entered. If \a status is false, then mouse was left. | |
49 |
|
49 | |||
50 | The signal is emitted if mouse is hovered on top of set |
|
50 | The signal is emitted if mouse is hovered on top of set | |
51 | Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series. |
|
51 | Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series. | |
52 | */ |
|
52 | */ | |
53 |
|
53 | |||
54 | /*! |
|
54 | /*! | |
55 | Constructs QBarSet with a name of \a name and with parent of \a parent |
|
55 | Constructs QBarSet with a name of \a name and with parent of \a parent | |
56 | */ |
|
56 | */ | |
57 | QBarSet::QBarSet(const QString name, QObject *parent) |
|
57 | QBarSet::QBarSet(const QString name, QObject *parent) | |
58 | : QObject(parent) |
|
58 | : QObject(parent) | |
59 | ,d_ptr(new QBarSetPrivate(name,this)) |
|
59 | ,d_ptr(new QBarSetPrivate(name,this)) | |
60 | { |
|
60 | { | |
61 | } |
|
61 | } | |
62 |
|
62 | |||
63 | /*! |
|
63 | /*! | |
64 | Destroys the barset |
|
64 | Destroys the barset | |
65 | */ |
|
65 | */ | |
66 | QBarSet::~QBarSet() |
|
66 | QBarSet::~QBarSet() | |
67 | { |
|
67 | { | |
68 | // NOTE: d_ptr destroyed by QObject |
|
68 | // NOTE: d_ptr destroyed by QObject | |
69 | } |
|
69 | } | |
70 |
|
70 | |||
71 | /*! |
|
71 | /*! | |
72 | Sets new \a name for set. |
|
72 | Sets new \a name for set. | |
73 | */ |
|
73 | */ | |
74 | void QBarSet::setName(const QString name) |
|
74 | void QBarSet::setName(const QString name) | |
75 | { |
|
75 | { | |
76 | d_ptr->m_name = name; |
|
76 | d_ptr->m_name = name; | |
77 | } |
|
77 | } | |
78 |
|
78 | |||
79 | /*! |
|
79 | /*! | |
80 | Returns name of the set. |
|
80 | Returns name of the set. | |
81 | */ |
|
81 | */ | |
82 | QString QBarSet::name() const |
|
82 | QString QBarSet::name() const | |
83 | { |
|
83 | { | |
84 | return d_ptr->m_name; |
|
84 | return d_ptr->m_name; | |
85 | } |
|
85 | } | |
86 |
|
86 | |||
87 | /*! |
|
87 | /*! | |
88 | Appends a point to set. Parameter \a value x coordinate defines the |
|
88 | Appends a point to set. Parameter \a value x coordinate defines the | |
89 | position in x-axis and y coordinate defines the height of bar. |
|
89 | position in x-axis and y coordinate defines the height of bar. | |
90 | Depending on presentation (QBarSeries, QGroupedBarSeries, QStackedBarSeries, QPercentBarSeries) |
|
90 | Depending on presentation (QBarSeries, QGroupedBarSeries, QStackedBarSeries, QPercentBarSeries) | |
91 | the x values are used or ignored. |
|
91 | the x values are used or ignored. | |
92 | */ |
|
92 | */ | |
93 | void QBarSet::append(const QPointF value) |
|
93 | void QBarSet::append(const QPointF value) | |
94 | { |
|
94 | { | |
95 | d_ptr->m_values.append(value); |
|
95 | d_ptr->m_values.append(value); | |
96 | emit d_ptr->restructuredBars(); |
|
96 | emit d_ptr->restructuredBars(); | |
97 | } |
|
97 | } | |
98 |
|
98 | |||
99 | /*! |
|
99 | /*! | |
100 |
Appends a list of \a |
|
100 | Appends a list of \a values to set. Works like append with single point. | |
101 | \sa append() |
|
101 | \sa append() | |
102 | */ |
|
102 | */ | |
103 | void QBarSet::append(const QList<QPointF> values) |
|
103 | void QBarSet::append(const QList<QPointF> values) | |
104 | { |
|
104 | { | |
105 | for (int i=0; i<values.count(); i++) { |
|
105 | for (int i=0; i<values.count(); i++) { | |
106 | d_ptr->m_values.append(values.at(i)); |
|
106 | d_ptr->m_values.append(values.at(i)); | |
107 | } |
|
107 | } | |
108 | emit d_ptr->restructuredBars(); |
|
108 | emit d_ptr->restructuredBars(); | |
109 | } |
|
109 | } | |
110 |
|
110 | |||
111 | /*! |
|
111 | /*! | |
112 | Appends new value \a value to the end of set. Internally the value is converted to QPointF, |
|
112 | Appends new value \a value to the end of set. Internally the value is converted to QPointF, | |
113 | with x coordinate being the index of appended value and y coordinate is the value. |
|
113 | with x coordinate being the index of appended value and y coordinate is the value. | |
114 | */ |
|
114 | */ | |
115 | void QBarSet::append(const qreal value) |
|
115 | void QBarSet::append(const qreal value) | |
116 | { |
|
116 | { | |
117 | append(QPointF(d_ptr->m_values.count(), value)); |
|
117 | append(QPointF(d_ptr->m_values.count(), value)); | |
118 | } |
|
118 | } | |
119 |
|
119 | |||
120 | /*! |
|
120 | /*! | |
121 | Appends a list of reals to set. Works like append with single real value. The values in list |
|
121 | Appends a list of reals to set. Works like append with single real value. The values in list | |
122 | are converted to QPointF, where x coordinate is the index of point and y coordinate is the value. |
|
122 | are converted to QPointF, where x coordinate is the index of point and y coordinate is the value. | |
123 | \sa append() |
|
123 | \sa append() | |
124 | */ |
|
124 | */ | |
125 | void QBarSet::append(const QList<qreal> values) |
|
125 | void QBarSet::append(const QList<qreal> values) | |
126 | { |
|
126 | { | |
127 | int index = d_ptr->m_values.count(); |
|
127 | int index = d_ptr->m_values.count(); | |
128 | for (int i=0; i<values.count(); i++) { |
|
128 | for (int i=0; i<values.count(); i++) { | |
129 | d_ptr->m_values.append(QPointF(index,values.at(i))); |
|
129 | d_ptr->m_values.append(QPointF(index,values.at(i))); | |
130 | index++; |
|
130 | index++; | |
131 | } |
|
131 | } | |
132 | emit d_ptr->restructuredBars(); |
|
132 | emit d_ptr->restructuredBars(); | |
133 | } |
|
133 | } | |
134 |
|
134 | |||
135 | /*! |
|
135 | /*! | |
136 | Convinience operator. Same as append, with real \a value. |
|
136 | Convinience operator. Same as append, with real \a value. | |
137 | \sa append() |
|
137 | \sa append() | |
138 | */ |
|
138 | */ | |
139 | QBarSet& QBarSet::operator << (const qreal &value) |
|
139 | QBarSet& QBarSet::operator << (const qreal &value) | |
140 | { |
|
140 | { | |
141 | append(value); |
|
141 | append(value); | |
142 | return *this; |
|
142 | return *this; | |
143 | } |
|
143 | } | |
144 |
|
144 | |||
145 | /*! |
|
145 | /*! | |
146 | Convinience operator. Same as append, with QPointF \a value. |
|
146 | Convinience operator. Same as append, with QPointF \a value. | |
147 | \sa append() |
|
147 | \sa append() | |
148 | */ |
|
148 | */ | |
149 | QBarSet& QBarSet::operator << (const QPointF &value) |
|
149 | QBarSet& QBarSet::operator << (const QPointF &value) | |
150 | { |
|
150 | { | |
151 | append(value); |
|
151 | append(value); | |
152 | return *this; |
|
152 | return *this; | |
153 | } |
|
153 | } | |
154 |
|
154 | |||
155 | /*! |
|
155 | /*! | |
156 | Inserts new \a value on the \a index position. |
|
156 | Inserts new \a value on the \a index position. | |
157 | The value that is currently at this postion is moved to postion index + 1 |
|
157 | The value that is currently at this postion is moved to postion index + 1 | |
158 | \sa remove() |
|
158 | \sa remove() | |
159 | */ |
|
159 | */ | |
160 | void QBarSet::insert(const int index, const qreal value) |
|
160 | void QBarSet::insert(const int index, const qreal value) | |
161 | { |
|
161 | { | |
162 | d_ptr->m_values.insert(index, QPointF(index, value)); |
|
162 | d_ptr->m_values.insert(index, QPointF(index, value)); | |
163 | // emit d_ptr->updatedBars(); |
|
163 | // emit d_ptr->updatedBars(); | |
164 | } |
|
164 | } | |
165 |
|
165 | |||
166 | /*! |
|
166 | /*! | |
167 | Removes the value specified by \a index |
|
167 | Removes the value specified by \a index | |
168 | \sa insert() |
|
168 | \sa insert() | |
169 | */ |
|
169 | */ | |
170 | void QBarSet::remove(const int index) |
|
170 | void QBarSet::remove(const int index) | |
171 | { |
|
171 | { | |
172 | d_ptr->m_values.removeAt(index); |
|
172 | d_ptr->m_values.removeAt(index); | |
173 | // emit d_ptr->updatedBars(); |
|
173 | // emit d_ptr->updatedBars(); | |
174 | } |
|
174 | } | |
175 |
|
175 | |||
176 | /*! |
|
176 | /*! | |
177 | Sets a new value \a value to set, indexed by \a index |
|
177 | Sets a new value \a value to set, indexed by \a index | |
178 | */ |
|
178 | */ | |
179 | void QBarSet::replace(const int index, const qreal value) |
|
179 | void QBarSet::replace(const int index, const qreal value) | |
180 | { |
|
180 | { | |
181 | d_ptr->m_values.replace(index,QPointF(index,value)); |
|
181 | d_ptr->m_values.replace(index,QPointF(index,value)); | |
182 | emit d_ptr->updatedBars(); |
|
182 | emit d_ptr->updatedBars(); | |
183 | } |
|
183 | } | |
184 |
|
184 | |||
185 | /*! |
|
185 | /*! | |
186 | Returns value of set indexed by \a index. Note that all appended values are stored internally as QPointF. |
|
186 | Returns value of set indexed by \a index. Note that all appended values are stored internally as QPointF. | |
187 | The returned QPointF has x coordinate, which is index (if appended with qreal append) or the x value |
|
187 | The returned QPointF has x coordinate, which is index (if appended with qreal append) or the x value | |
188 | of the QPointF (if appended with QPointF append). |
|
188 | of the QPointF (if appended with QPointF append). | |
189 | If the index is out of bounds QPointF(0, 0.0) is returned. |
|
189 | If the index is out of bounds QPointF(0, 0.0) is returned. | |
190 | */ |
|
190 | */ | |
191 | QPointF QBarSet::at(const int index) const |
|
191 | QPointF QBarSet::at(const int index) const | |
192 | { |
|
192 | { | |
193 | if (index < 0 || index >= d_ptr->m_values.count()) { |
|
193 | if (index < 0 || index >= d_ptr->m_values.count()) { | |
194 | return QPointF(index, 0.0); |
|
194 | return QPointF(index, 0.0); | |
195 | } |
|
195 | } | |
196 |
|
196 | |||
197 | return d_ptr->m_values.at(index); |
|
197 | return d_ptr->m_values.at(index); | |
198 | } |
|
198 | } | |
199 |
|
199 | |||
200 | /*! |
|
200 | /*! | |
201 | Returns value of set indexed by \a index. ote that all appended values are stored internally as QPointF. |
|
201 | Returns value of set indexed by \a index. ote that all appended values are stored internally as QPointF. | |
202 | The returned QPointF has x coordinate, which is index (if appended with qreal append) or the x value |
|
202 | The returned QPointF has x coordinate, which is index (if appended with qreal append) or the x value | |
203 | of the QPointF (if appended with QPointF append). |
|
203 | of the QPointF (if appended with QPointF append). | |
204 | */ |
|
204 | */ | |
205 | QPointF QBarSet::operator [](const int index) const |
|
205 | QPointF QBarSet::operator [](const int index) const | |
206 | { |
|
206 | { | |
207 | return d_ptr->m_values.at(index); |
|
207 | return d_ptr->m_values.at(index); | |
208 | } |
|
208 | } | |
209 |
|
209 | |||
210 | /*! |
|
210 | /*! | |
211 | Returns count of values in set. |
|
211 | Returns count of values in set. | |
212 | */ |
|
212 | */ | |
213 | int QBarSet::count() const |
|
213 | int QBarSet::count() const | |
214 | { |
|
214 | { | |
215 | return d_ptr->m_values.count(); |
|
215 | return d_ptr->m_values.count(); | |
216 | } |
|
216 | } | |
217 |
|
217 | |||
218 | /*! |
|
218 | /*! | |
219 | Returns sum of all values in barset. The sum is sum of y coordinates in the QPointF representation. |
|
219 | Returns sum of all values in barset. The sum is sum of y coordinates in the QPointF representation. | |
220 | */ |
|
220 | */ | |
221 | qreal QBarSet::sum() const |
|
221 | qreal QBarSet::sum() const | |
222 | { |
|
222 | { | |
223 | qreal total(0); |
|
223 | qreal total(0); | |
224 | for (int i=0; i < d_ptr->m_values.count(); i++) { |
|
224 | for (int i=0; i < d_ptr->m_values.count(); i++) { | |
225 | //total += d_ptr->m_values.at(i); |
|
225 | //total += d_ptr->m_values.at(i); | |
226 | total += d_ptr->m_values.at(i).y(); |
|
226 | total += d_ptr->m_values.at(i).y(); | |
227 | } |
|
227 | } | |
228 | return total; |
|
228 | return total; | |
229 | } |
|
229 | } | |
230 |
|
230 | |||
231 | /*! |
|
231 | /*! | |
232 | Sets pen for set. Bars of this set are drawn using \a pen |
|
232 | Sets pen for set. Bars of this set are drawn using \a pen | |
233 | */ |
|
233 | */ | |
234 | void QBarSet::setPen(const QPen &pen) |
|
234 | void QBarSet::setPen(const QPen &pen) | |
235 | { |
|
235 | { | |
236 | if(d_ptr->m_pen!=pen){ |
|
236 | if(d_ptr->m_pen!=pen){ | |
237 | d_ptr->m_pen = pen; |
|
237 | d_ptr->m_pen = pen; | |
238 | emit d_ptr->updatedBars(); |
|
238 | emit d_ptr->updatedBars(); | |
239 | } |
|
239 | } | |
240 | } |
|
240 | } | |
241 |
|
241 | |||
242 | /*! |
|
242 | /*! | |
243 | Returns pen of the set. |
|
243 | Returns pen of the set. | |
244 | */ |
|
244 | */ | |
245 | QPen QBarSet::pen() const |
|
245 | QPen QBarSet::pen() const | |
246 | { |
|
246 | { | |
247 | return d_ptr->m_pen; |
|
247 | return d_ptr->m_pen; | |
248 | } |
|
248 | } | |
249 |
|
249 | |||
250 | /*! |
|
250 | /*! | |
251 | Sets brush for the set. Bars of this set are drawn using \a brush |
|
251 | Sets brush for the set. Bars of this set are drawn using \a brush | |
252 | */ |
|
252 | */ | |
253 | void QBarSet::setBrush(const QBrush &brush) |
|
253 | void QBarSet::setBrush(const QBrush &brush) | |
254 | { |
|
254 | { | |
255 | if(d_ptr->m_brush!=brush){ |
|
255 | if(d_ptr->m_brush!=brush){ | |
256 | d_ptr->m_brush = brush; |
|
256 | d_ptr->m_brush = brush; | |
257 | emit d_ptr->updatedBars(); |
|
257 | emit d_ptr->updatedBars(); | |
258 | } |
|
258 | } | |
259 | } |
|
259 | } | |
260 |
|
260 | |||
261 | /*! |
|
261 | /*! | |
262 | Returns brush of the set. |
|
262 | Returns brush of the set. | |
263 | */ |
|
263 | */ | |
264 | QBrush QBarSet::brush() const |
|
264 | QBrush QBarSet::brush() const | |
265 | { |
|
265 | { | |
266 | return d_ptr->m_brush; |
|
266 | return d_ptr->m_brush; | |
267 | } |
|
267 | } | |
268 |
|
268 | |||
269 | /*! |
|
269 | /*! | |
270 | Sets \a pen of the values that are drawn on top of this barset |
|
270 | Sets \a pen of the values that are drawn on top of this barset | |
271 | */ |
|
271 | */ | |
272 | void QBarSet::setLabelPen(const QPen &pen) |
|
272 | void QBarSet::setLabelPen(const QPen &pen) | |
273 | { |
|
273 | { | |
274 | if(d_ptr->m_labelPen!=pen){ |
|
274 | if(d_ptr->m_labelPen!=pen){ | |
275 | d_ptr->m_labelPen = pen; |
|
275 | d_ptr->m_labelPen = pen; | |
276 | emit d_ptr->updatedBars(); |
|
276 | emit d_ptr->updatedBars(); | |
277 | } |
|
277 | } | |
278 | } |
|
278 | } | |
279 |
|
279 | |||
280 | /*! |
|
280 | /*! | |
281 | Returns pen of the values that are drawn on top of this barset |
|
281 | Returns pen of the values that are drawn on top of this barset | |
282 | */ |
|
282 | */ | |
283 | QPen QBarSet::labelPen() const |
|
283 | QPen QBarSet::labelPen() const | |
284 | { |
|
284 | { | |
285 | return d_ptr->m_labelPen; |
|
285 | return d_ptr->m_labelPen; | |
286 | } |
|
286 | } | |
287 |
|
287 | |||
288 | /*! |
|
288 | /*! | |
289 | Sets \a brush of the values that are drawn on top of this barset |
|
289 | Sets \a brush of the values that are drawn on top of this barset | |
290 | */ |
|
290 | */ | |
291 | void QBarSet::setLabelBrush(const QBrush &brush) |
|
291 | void QBarSet::setLabelBrush(const QBrush &brush) | |
292 | { |
|
292 | { | |
293 | if(d_ptr->m_labelBrush!=brush){ |
|
293 | if(d_ptr->m_labelBrush!=brush){ | |
294 | d_ptr->m_labelBrush = brush; |
|
294 | d_ptr->m_labelBrush = brush; | |
295 | emit d_ptr->updatedBars(); |
|
295 | emit d_ptr->updatedBars(); | |
296 | } |
|
296 | } | |
297 | } |
|
297 | } | |
298 |
|
298 | |||
299 | /*! |
|
299 | /*! | |
300 | Returns brush of the values that are drawn on top of this barset |
|
300 | Returns brush of the values that are drawn on top of this barset | |
301 | */ |
|
301 | */ | |
302 | QBrush QBarSet::labelBrush() const |
|
302 | QBrush QBarSet::labelBrush() const | |
303 | { |
|
303 | { | |
304 | return d_ptr->m_labelBrush; |
|
304 | return d_ptr->m_labelBrush; | |
305 | } |
|
305 | } | |
306 |
|
306 | |||
307 | /*! |
|
307 | /*! | |
308 | Sets the \a font for values that are drawn on top of this barset |
|
308 | Sets the \a font for values that are drawn on top of this barset | |
309 | */ |
|
309 | */ | |
310 | void QBarSet::setLabelFont(const QFont &font) |
|
310 | void QBarSet::setLabelFont(const QFont &font) | |
311 | { |
|
311 | { | |
312 | if(d_ptr->m_labelFont!=font) { |
|
312 | if(d_ptr->m_labelFont!=font) { | |
313 | d_ptr->m_labelFont = font; |
|
313 | d_ptr->m_labelFont = font; | |
314 | emit d_ptr->updatedBars(); |
|
314 | emit d_ptr->updatedBars(); | |
315 | } |
|
315 | } | |
316 |
|
316 | |||
317 | } |
|
317 | } | |
318 |
|
318 | |||
319 | /*! |
|
319 | /*! | |
320 | Returns the pen for values that are drawn on top of this set |
|
320 | Returns the pen for values that are drawn on top of this set | |
321 | */ |
|
321 | */ | |
322 | QFont QBarSet::labelFont() const |
|
322 | QFont QBarSet::labelFont() const | |
323 | { |
|
323 | { | |
324 | return d_ptr->m_labelFont; |
|
324 | return d_ptr->m_labelFont; | |
325 | } |
|
325 | } | |
326 |
|
326 | |||
327 | /*! |
|
327 | /*! | |
328 | Sets visibility of bar labels. If \a visible is true, labels are drawn on top of barsets. |
|
328 | Sets visibility of bar labels. If \a visible is true, labels are drawn on top of barsets. | |
329 | */ |
|
329 | */ | |
330 |
|
330 | |||
331 | void QBarSet::setLabelsVisible(bool visible) |
|
331 | void QBarSet::setLabelsVisible(bool visible) | |
332 | { |
|
332 | { | |
333 | if(d_ptr->m_labelsVisible!=visible) { |
|
333 | if(d_ptr->m_labelsVisible!=visible) { | |
334 | d_ptr->m_labelsVisible = visible; |
|
334 | d_ptr->m_labelsVisible = visible; | |
335 | emit d_ptr->labelsVisibleChanged(visible); |
|
335 | emit d_ptr->labelsVisibleChanged(visible); | |
336 | } |
|
336 | } | |
337 | } |
|
337 | } | |
338 |
|
338 | |||
339 | /*! |
|
339 | /*! | |
340 | Returns the visibility of values |
|
340 | Returns the visibility of values | |
341 | */ |
|
341 | */ | |
342 | bool QBarSet::labelsVisible() const |
|
342 | bool QBarSet::labelsVisible() const | |
343 | { |
|
343 | { | |
344 | return d_ptr->m_labelsVisible; |
|
344 | return d_ptr->m_labelsVisible; | |
345 | } |
|
345 | } | |
346 |
|
346 | |||
347 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
347 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
348 |
|
348 | |||
349 | QBarSetPrivate::QBarSetPrivate(const QString name, QBarSet *parent) : QObject(parent), |
|
349 | QBarSetPrivate::QBarSetPrivate(const QString name, QBarSet *parent) : QObject(parent), | |
350 | q_ptr(parent), |
|
350 | q_ptr(parent), | |
351 | m_name(name), |
|
351 | m_name(name), | |
352 | m_labelsVisible(false) |
|
352 | m_labelsVisible(false) | |
353 | { |
|
353 | { | |
354 | } |
|
354 | } | |
355 |
|
355 | |||
356 | QBarSetPrivate::~QBarSetPrivate() |
|
356 | QBarSetPrivate::~QBarSetPrivate() | |
357 | { |
|
357 | { | |
358 | } |
|
358 | } | |
359 |
|
359 | |||
360 | #include "moc_qbarset.cpp" |
|
360 | #include "moc_qbarset.cpp" | |
361 | #include "moc_qbarset_p.cpp" |
|
361 | #include "moc_qbarset_p.cpp" | |
362 |
|
362 | |||
363 | QTCOMMERCIALCHART_END_NAMESPACE |
|
363 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now