@@ -1,308 +1,499 | |||
|
1 | 1 | #include "qpieseries.h" |
|
2 | 2 | #include "qpieslice.h" |
|
3 | 3 | #include "piepresenter.h" |
|
4 | 4 | #include "pieslice.h" |
|
5 | 5 | #include <QFontMetrics> |
|
6 | 6 | #include <QDebug> |
|
7 | 7 | |
|
8 | 8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
9 | 9 | |
|
10 | /*! | |
|
11 | \enum QPieSeries::PiePosition | |
|
12 | ||
|
13 | This enum describes pie position within its bounding rectangle | |
|
14 | ||
|
15 | \value PiePositionMaximized | |
|
16 | \value PiePositionTopLeft | |
|
17 | \value PiePositionTopRight | |
|
18 | \value PiePositionBottomLeft | |
|
19 | \value PiePositionBottomRight | |
|
20 | */ | |
|
21 | ||
|
22 | /*! | |
|
23 | \class QPieSeries | |
|
24 | \brief QtCommercial charts pie series API. | |
|
25 | ||
|
26 | */ | |
|
27 | ||
|
10 | 28 | void QPieSeries::ChangeSet::appendAdded(QPieSlice* slice) |
|
11 | 29 | { |
|
12 | 30 | if (!m_added.contains(slice)) |
|
13 | 31 | m_added << slice; |
|
14 | 32 | } |
|
15 | 33 | |
|
16 | 34 | void QPieSeries::ChangeSet::appendAdded(QList<QPieSlice*> slices) |
|
17 | 35 | { |
|
18 | 36 | foreach (QPieSlice* s, slices) |
|
19 | 37 | appendAdded(s); |
|
20 | 38 | } |
|
21 | 39 | |
|
22 | 40 | void QPieSeries::ChangeSet::appendChanged(QPieSlice* slice) |
|
23 | 41 | { |
|
24 | 42 | if (!m_changed.contains(slice)) |
|
25 | 43 | m_changed << slice; |
|
26 | 44 | } |
|
27 | 45 | |
|
28 | 46 | void QPieSeries::ChangeSet::appendRemoved(QPieSlice* slice) |
|
29 | 47 | { |
|
30 | 48 | if (!m_removed.contains(slice)) |
|
31 | 49 | m_removed << slice; |
|
32 | 50 | } |
|
33 | 51 | |
|
52 | /*! | |
|
53 | Returns a list of slices that have been added to the series. | |
|
54 | \sa QPieSeries::changed() | |
|
55 | */ | |
|
34 | 56 | QList<QPieSlice*> QPieSeries::ChangeSet::added() const |
|
35 | 57 | { |
|
36 | 58 | return m_added; |
|
37 | 59 | } |
|
38 | 60 | |
|
61 | /*! | |
|
62 | Returns a list of slices that have been changed in the series. | |
|
63 | \sa QPieSeries::changed() | |
|
64 | */ | |
|
39 | 65 | QList<QPieSlice*> QPieSeries::ChangeSet::changed() const |
|
40 | 66 | { |
|
41 | 67 | return m_changed; |
|
42 | 68 | } |
|
43 | 69 | |
|
70 | /*! | |
|
71 | Returns a list of slices that have been removed from the series. | |
|
72 | \sa QPieSeries::changed() | |
|
73 | */ | |
|
44 | 74 | QList<QPieSlice*> QPieSeries::ChangeSet::removed() const |
|
45 | 75 | { |
|
46 | 76 | return m_removed; |
|
47 | 77 | } |
|
48 | 78 | |
|
79 | ||
|
80 | /*! | |
|
81 | Returns true if there are no added/changed or removed slices in the change set. | |
|
82 | */ | |
|
49 | 83 | bool QPieSeries::ChangeSet::isEmpty() const |
|
50 | 84 | { |
|
51 | 85 | if (m_added.count() || m_changed.count() || m_removed.count()) |
|
52 | 86 | return false; |
|
53 | 87 | return true; |
|
54 | 88 | } |
|
55 | 89 | |
|
56 | ||
|
90 | /*! | |
|
91 | Constructs a series object which is a child of \a parent. | |
|
92 | */ | |
|
57 | 93 | QPieSeries::QPieSeries(QObject *parent) : |
|
58 | 94 | QChartSeries(parent), |
|
59 | 95 | m_sizeFactor(1.0), |
|
60 | 96 | m_position(PiePositionMaximized), |
|
61 | 97 | m_pieStartAngle(0), |
|
62 | m_pieSpan(360) | |
|
98 | m_pieAngleSpan(360) | |
|
63 | 99 | { |
|
64 | 100 | |
|
65 | 101 | } |
|
66 | 102 | |
|
103 | /*! | |
|
104 | Destroys the object. Note that adding series to QChart transfers the ownership to the chart. | |
|
105 | */ | |
|
67 | 106 | QPieSeries::~QPieSeries() |
|
68 | 107 | { |
|
69 | 108 | |
|
70 | 109 | } |
|
71 | 110 | |
|
111 | /*! | |
|
112 | Returns the type of the series which is always QChartSeries::SeriesTypePie. | |
|
113 | */ | |
|
114 | QChartSeries::QChartSeriesType QPieSeries::type() const | |
|
115 | { | |
|
116 | return QChartSeries::SeriesTypePie; | |
|
117 | } | |
|
118 | ||
|
119 | /*! | |
|
120 | Sets an array of values to the series. | |
|
121 | TO BE REMOVED | |
|
122 | */ | |
|
72 | 123 | bool QPieSeries::setData(QList<qreal> data) |
|
73 | 124 | { |
|
74 | 125 | // TODO: remove this function |
|
75 | 126 | QList<QPieSlice*> slices; |
|
76 | 127 | foreach (qreal value, data) |
|
77 | 128 | slices << new QPieSlice(value, QString::number(value)); |
|
78 | 129 | set(slices); |
|
79 | 130 | return true; |
|
80 | 131 | } |
|
81 | 132 | |
|
133 | /*! | |
|
134 | Sets an array of \a slices to the series. | |
|
135 | Slice ownership is passed to the series. | |
|
136 | */ | |
|
82 | 137 | void QPieSeries::set(QList<QPieSlice*> slices) |
|
83 | 138 | { |
|
84 | 139 | clear(); |
|
85 | 140 | add(slices); |
|
86 | 141 | } |
|
87 | 142 | |
|
143 | /*! | |
|
144 | Adds an array of slices to the series. | |
|
145 | Slice ownership is passed to the series. | |
|
146 | */ | |
|
88 | 147 | void QPieSeries::add(QList<QPieSlice*> slices) |
|
89 | 148 | { |
|
90 | 149 | ChangeSet changeSet; |
|
91 | 150 | foreach (QPieSlice* s, slices) { |
|
92 | 151 | s->setParent(this); |
|
93 | 152 | m_slices << s; |
|
94 | 153 | changeSet.appendAdded(s); |
|
95 | 154 | } |
|
96 | 155 | |
|
97 | 156 | updateDerivativeData(); |
|
98 | 157 | |
|
99 | 158 | foreach (QPieSlice* s, slices) { |
|
100 | 159 | connect(s, SIGNAL(changed()), this, SLOT(sliceChanged())); |
|
101 | 160 | connect(s, SIGNAL(clicked()), this, SLOT(sliceClicked())); |
|
102 | 161 | connect(s, SIGNAL(hoverEnter()), this, SLOT(sliceHoverEnter())); |
|
103 | 162 | connect(s, SIGNAL(hoverLeave()), this, SLOT(sliceHoverLeave())); |
|
104 | 163 | } |
|
105 | 164 | |
|
106 | 165 | emit changed(changeSet); |
|
107 | 166 | } |
|
108 | 167 | |
|
168 | /*! | |
|
169 | Adds a single \a slice to the series. | |
|
170 | Slice ownership is passed to the series. | |
|
171 | */ | |
|
109 | 172 | void QPieSeries::add(QPieSlice* slice) |
|
110 | 173 | { |
|
111 | 174 | add(QList<QPieSlice*>() << slice); |
|
112 | 175 | } |
|
113 | 176 | |
|
177 | ||
|
178 | /*! | |
|
179 | Adds a single slice to the series with give \a value and \a name. | |
|
180 | Slice ownership is passed to the series. | |
|
181 | */ | |
|
114 | 182 | QPieSlice* QPieSeries::add(qreal value, QString name) |
|
115 | 183 | { |
|
116 | 184 | QPieSlice* slice = new QPieSlice(value, name); |
|
117 | 185 | add(slice); |
|
118 | 186 | return slice; |
|
119 | 187 | } |
|
120 | 188 | |
|
189 | /*! | |
|
190 | Removes a single \a slice from the series and deletes the slice. | |
|
191 | Do not reference this pointer after this call. | |
|
192 | */ | |
|
121 | 193 | void QPieSeries::remove(QPieSlice* slice) |
|
122 | 194 | { |
|
123 | 195 | if (!m_slices.removeOne(slice)) { |
|
124 | 196 | Q_ASSERT(0); // TODO: how should this be reported? |
|
125 | 197 | return; |
|
126 | 198 | } |
|
127 | 199 | |
|
128 | 200 | ChangeSet changeSet; |
|
129 | 201 | changeSet.appendRemoved(slice); |
|
130 | 202 | emit changed(changeSet); |
|
131 | 203 | |
|
132 | 204 | delete slice; |
|
133 | 205 | slice = NULL; |
|
134 | 206 | |
|
135 | 207 | updateDerivativeData(); |
|
136 | 208 | } |
|
137 | 209 | |
|
210 | /*! | |
|
211 | Clears all slices from the series. | |
|
212 | */ | |
|
138 | 213 | void QPieSeries::clear() |
|
139 | 214 | { |
|
140 | 215 | if (m_slices.count() == 0) |
|
141 | 216 | return; |
|
142 | 217 | |
|
143 | 218 | ChangeSet changeSet; |
|
144 | 219 | foreach (QPieSlice* s, m_slices) { |
|
145 | 220 | changeSet.appendRemoved(s); |
|
146 | 221 | m_slices.removeOne(s); |
|
147 | 222 | delete s; |
|
148 | 223 | } |
|
149 | 224 | emit changed(changeSet); |
|
150 | 225 | updateDerivativeData(); |
|
151 | 226 | } |
|
152 | 227 | |
|
228 | /*! | |
|
229 | Counts the number of the slices in this series. | |
|
230 | */ | |
|
231 | int QPieSeries::count() const | |
|
232 | { | |
|
233 | return m_slices.count(); | |
|
234 | } | |
|
235 | ||
|
236 | /*! | |
|
237 | Returns a list of slices that belong to this series. | |
|
238 | */ | |
|
239 | QList<QPieSlice*> QPieSeries::slices() const | |
|
240 | { | |
|
241 | return m_slices; | |
|
242 | } | |
|
243 | ||
|
244 | /*! | |
|
245 | Sets the size \a factor of the pie. 1.0 is the default value. | |
|
246 | Note that the pie will not grow beyond its absolute maximum size. | |
|
247 | In practice its use is to make the pie appear smaller. | |
|
248 | \sa sizeFactor() | |
|
249 | */ | |
|
153 | 250 | void QPieSeries::setSizeFactor(qreal factor) |
|
154 | 251 | { |
|
155 | 252 | if (factor < 0.0) |
|
156 | 253 | return; |
|
157 | 254 | |
|
158 | 255 | if (m_sizeFactor != factor) { |
|
159 | 256 | m_sizeFactor = factor; |
|
160 | 257 | emit sizeFactorChanged(); |
|
161 | 258 | } |
|
162 | 259 | } |
|
163 | 260 | |
|
261 | /*! | |
|
262 | Gets the size factor of the pie. | |
|
263 | \sa setSizeFactor() | |
|
264 | */ | |
|
265 | qreal QPieSeries::sizeFactor() const | |
|
266 | { | |
|
267 | return m_sizeFactor; | |
|
268 | } | |
|
269 | ||
|
270 | /*! | |
|
271 | Sets the \a position of the pie within its bounding rectangle. | |
|
272 | \sa PiePosition, position() | |
|
273 | */ | |
|
164 | 274 | void QPieSeries::setPosition(PiePosition position) |
|
165 | 275 | { |
|
166 | 276 | if (m_position != position) { |
|
167 | 277 | m_position = position; |
|
168 | 278 | emit positionChanged(); |
|
169 | 279 | } |
|
170 | 280 | } |
|
171 | 281 | |
|
172 | void QPieSeries::setSpan(qreal startAngle, qreal span) | |
|
282 | /*! | |
|
283 | Gets the position of the pie within its bounding rectangle. | |
|
284 | \sa PiePosition, setPosition() | |
|
285 | */ | |
|
286 | QPieSeries::PiePosition QPieSeries::position() const | |
|
287 | { | |
|
288 | return m_position; | |
|
289 | } | |
|
290 | ||
|
291 | ||
|
292 | /*! | |
|
293 | Sets the \a startAngle and \a angleSpan of this series. | |
|
294 | ||
|
295 | \sa | |
|
296 | */ | |
|
297 | void QPieSeries::setSpan(qreal startAngle, qreal angleSpan) | |
|
173 | 298 | { |
|
174 | 299 | if (startAngle >= 0 && startAngle < 360 && |
|
175 |
|
|
|
300 | angleSpan > 0 && angleSpan <= 360) { | |
|
176 | 301 | m_pieStartAngle = startAngle; |
|
177 |
m_pieSpan = |
|
|
302 | m_pieAngleSpan = angleSpan; | |
|
178 | 303 | updateDerivativeData(); |
|
179 | 304 | } |
|
180 | 305 | } |
|
181 | 306 | |
|
307 | /*! | |
|
308 | Sets the all the slice labels \a visible or invisible. | |
|
309 | ||
|
310 | \sa QPieSlice::isLabelVisible(), QPieSlice::setLabelVisible() | |
|
311 | */ | |
|
182 | 312 | void QPieSeries::setLabelsVisible(bool visible) |
|
183 | 313 | { |
|
184 | 314 | foreach (QPieSlice* s, m_slices) |
|
185 | 315 | s->setLabelVisible(visible); |
|
186 | 316 | } |
|
187 | 317 | |
|
318 | /*! | |
|
319 | Convenience method for exploding a slice when user clicks the pie. | |
|
320 | ||
|
321 | \sa QPieSlice::isExploded(), QPieSlice::setExploded() | |
|
322 | */ | |
|
188 | 323 | void QPieSeries::enableClickExplodes(bool enable) |
|
189 | 324 | { |
|
190 | 325 | if (enable) |
|
191 | 326 | connect(this, SIGNAL(clicked(QPieSlice*)), this, SLOT(toggleExploded(QPieSlice*))); |
|
192 | 327 | else |
|
193 | 328 | disconnect(this, SLOT(toggleExploded(QPieSlice*))); |
|
194 | 329 | } |
|
195 | 330 | |
|
331 | /*! | |
|
332 | Convenience method for highlighting a slice when user hovers over the slice. | |
|
333 | It changes the slice color to be lighter and shows the label of the slice. | |
|
334 | ||
|
335 | \sa QPieSlice::isExploded(), QPieSlice::setExploded() | |
|
336 | */ | |
|
337 | ||
|
196 | 338 | void QPieSeries::enableHoverHighlight(bool enable) |
|
197 | 339 | { |
|
198 | 340 | if (enable) { |
|
199 | 341 | connect(this, SIGNAL(hoverEnter(QPieSlice*)), this, SLOT(highlightOn(QPieSlice*))); |
|
200 | 342 | connect(this, SIGNAL(hoverLeave(QPieSlice*)), this, SLOT(highlightOff(QPieSlice*))); |
|
201 | 343 | } else { |
|
202 | 344 | disconnect(this, SLOT(hoverEnter(QPieSlice*))); |
|
203 | 345 | disconnect(this, SLOT(hoverLeave(QPieSlice*))); |
|
204 | 346 | } |
|
205 | 347 | } |
|
206 | 348 | |
|
349 | /*! | |
|
350 | \fn void QPieSeries::changed(const QPieSeries::ChangeSet& changeSet) | |
|
351 | ||
|
352 | This signal emitted when something has changed in the series. | |
|
353 | The \a changeSet contains the details of which slices have been added, changed or removed. | |
|
354 | ||
|
355 | \sa QPieSeries::ChangeSet, QPieSlice::changed() | |
|
356 | */ | |
|
357 | ||
|
358 | /*! | |
|
359 | \fn void QPieSeries::clicked(QPieSlice* slice) | |
|
360 | ||
|
361 | This signal is emitted when a \a slice has been clicked. | |
|
362 | ||
|
363 | \sa QPieSlice::clicked() | |
|
364 | */ | |
|
365 | ||
|
366 | /*! | |
|
367 | \fn void QPieSeries::hoverEnter(QPieSlice* slice) | |
|
368 | ||
|
369 | This signal is emitted when user has hovered over a \a slice. | |
|
370 | ||
|
371 | \sa QPieSlice::hoverEnter() | |
|
372 | */ | |
|
373 | ||
|
374 | /*! | |
|
375 | \fn void QPieSeries::hoverLeave(QPieSlice* slice) | |
|
376 | ||
|
377 | This signal is emitted when user has hovered away from a \a slice. | |
|
378 | ||
|
379 | \sa QPieSlice::hoverLeave() | |
|
380 | */ | |
|
381 | ||
|
382 | /*! | |
|
383 | \fn void QPieSeries::sizeFactorChanged() | |
|
384 | ||
|
385 | This signal is emitted when size factor has been changed. | |
|
386 | ||
|
387 | \sa sizeFactor(), setSizeFactor() | |
|
388 | */ | |
|
389 | ||
|
390 | /*! | |
|
391 | \fn void QPieSeries::positionChanged() | |
|
392 | ||
|
393 | This signal is emitted when position of the pie has been changed. | |
|
394 | ||
|
395 | \sa position(), setPosition() | |
|
396 | */ | |
|
397 | ||
|
207 | 398 | void QPieSeries::sliceChanged() |
|
208 | 399 | { |
|
209 | 400 | QPieSlice* slice = qobject_cast<QPieSlice *>(sender()); |
|
210 | 401 | Q_ASSERT(m_slices.contains(slice)); |
|
211 | 402 | |
|
212 | 403 | ChangeSet changeSet; |
|
213 | 404 | changeSet.appendChanged(slice); |
|
214 | 405 | emit changed(changeSet); |
|
215 | 406 | |
|
216 | 407 | updateDerivativeData(); |
|
217 | 408 | } |
|
218 | 409 | |
|
219 | 410 | void QPieSeries::sliceClicked() |
|
220 | 411 | { |
|
221 | 412 | QPieSlice* slice = qobject_cast<QPieSlice *>(sender()); |
|
222 | 413 | Q_ASSERT(m_slices.contains(slice)); |
|
223 | 414 | emit clicked(slice); |
|
224 | 415 | } |
|
225 | 416 | |
|
226 | 417 | void QPieSeries::sliceHoverEnter() |
|
227 | 418 | { |
|
228 | 419 | QPieSlice* slice = qobject_cast<QPieSlice *>(sender()); |
|
229 | 420 | Q_ASSERT(m_slices.contains(slice)); |
|
230 | 421 | emit hoverEnter(slice); |
|
231 | 422 | } |
|
232 | 423 | |
|
233 | 424 | void QPieSeries::sliceHoverLeave() |
|
234 | 425 | { |
|
235 | 426 | QPieSlice* slice = qobject_cast<QPieSlice *>(sender()); |
|
236 | 427 | Q_ASSERT(m_slices.contains(slice)); |
|
237 | 428 | emit hoverLeave(slice); |
|
238 | 429 | } |
|
239 | 430 | |
|
240 | 431 | void QPieSeries::toggleExploded(QPieSlice* slice) |
|
241 | 432 | { |
|
242 | 433 | Q_ASSERT(slice); |
|
243 | 434 | slice->setExploded(!slice->isExploded()); |
|
244 | 435 | } |
|
245 | 436 | |
|
246 | 437 | void QPieSeries::highlightOn(QPieSlice* slice) |
|
247 | 438 | { |
|
248 | 439 | Q_ASSERT(slice); |
|
249 | 440 | QColor c = slice->brush().color().lighter(); |
|
250 | 441 | slice->setBrush(c); |
|
251 | 442 | slice->setLabelVisible(true); |
|
252 | 443 | } |
|
253 | 444 | |
|
254 | 445 | void QPieSeries::highlightOff(QPieSlice* slice) |
|
255 | 446 | { |
|
256 | 447 | Q_ASSERT(slice); |
|
257 | 448 | QColor c = slice->brush().color().darker(150); |
|
258 | 449 | slice->setBrush(c); |
|
259 | 450 | slice->setLabelVisible(false); |
|
260 | 451 | } |
|
261 | 452 | |
|
262 | 453 | void QPieSeries::updateDerivativeData() |
|
263 | 454 | { |
|
264 | 455 | m_total = 0; |
|
265 | 456 | |
|
266 | 457 | // nothing to do? |
|
267 | 458 | if (m_slices.count() == 0) |
|
268 | 459 | return; |
|
269 | 460 | |
|
270 | 461 | // calculate total |
|
271 | 462 | foreach (QPieSlice* s, m_slices) |
|
272 | 463 | m_total += s->value(); |
|
273 | 464 | |
|
274 | 465 | // we must have some values |
|
275 | 466 | Q_ASSERT(m_total > 0); // TODO: is this the correct way to handle this? |
|
276 | 467 | |
|
277 | 468 | // update slice attributes |
|
278 | 469 | qreal sliceAngle = m_pieStartAngle; |
|
279 | 470 | foreach (QPieSlice* s, m_slices) { |
|
280 | 471 | |
|
281 | 472 | bool changed = false; |
|
282 | 473 | |
|
283 | 474 | qreal percentage = s->value() / m_total; |
|
284 | 475 | if (s->m_percentage != percentage) { |
|
285 | 476 | s->m_percentage = percentage; |
|
286 | 477 | changed = true; |
|
287 | 478 | } |
|
288 | 479 | |
|
289 | qreal sliceSpan = m_pieSpan * percentage; | |
|
480 | qreal sliceSpan = m_pieAngleSpan * percentage; | |
|
290 | 481 | if (s->m_angleSpan != sliceSpan) { |
|
291 | 482 | s->m_angleSpan = sliceSpan; |
|
292 | 483 | changed = true; |
|
293 | 484 | } |
|
294 | 485 | |
|
295 | 486 | if (s->m_angle != sliceAngle) { |
|
296 | 487 | s->m_angle = sliceAngle; |
|
297 | 488 | changed = true; |
|
298 | 489 | } |
|
299 | 490 | sliceAngle += sliceSpan; |
|
300 | 491 | |
|
301 | 492 | if (changed) |
|
302 | 493 | emit s->changed(); |
|
303 | 494 | } |
|
304 | 495 | } |
|
305 | 496 | |
|
306 | 497 | #include "moc_qpieseries.cpp" |
|
307 | 498 | |
|
308 | 499 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,131 +1,133 | |||
|
1 | 1 | #ifndef PIESERIES_H |
|
2 | 2 | #define PIESERIES_H |
|
3 | 3 | |
|
4 | 4 | #include "qchartseries.h" |
|
5 | 5 | #include <QObject> |
|
6 | 6 | #include <QRectF> |
|
7 | 7 | #include <QColor> |
|
8 | 8 | #include <QPen> |
|
9 | 9 | #include <QBrush> |
|
10 | 10 | #include <QSignalMapper> |
|
11 | 11 | |
|
12 | 12 | class QGraphicsObject; |
|
13 | 13 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
14 | 14 | class PiePresenter; |
|
15 | 15 | class PieSlice; |
|
16 | 16 | class QPieSlice; |
|
17 | 17 | |
|
18 | 18 | class QTCOMMERCIALCHART_EXPORT QPieSeries : public QChartSeries |
|
19 | 19 | { |
|
20 | 20 | Q_OBJECT |
|
21 | 21 | |
|
22 | 22 | public: |
|
23 | 23 | enum PiePosition { |
|
24 | 24 | PiePositionMaximized = 0, |
|
25 | 25 | PiePositionTopLeft, |
|
26 | 26 | PiePositionTopRight, |
|
27 | 27 | PiePositionBottomLeft, |
|
28 | 28 | PiePositionBottomRight |
|
29 | 29 | }; |
|
30 | 30 | |
|
31 | 31 | class ChangeSet |
|
32 | 32 | { |
|
33 | 33 | public: |
|
34 | ||
|
35 | // TODO: these should not really be exposed to the public API | |
|
34 | 36 | void appendAdded(QPieSlice* slice); |
|
35 | 37 | void appendAdded(QList<QPieSlice*> slices); |
|
36 | 38 | void appendChanged(QPieSlice* slice); |
|
37 | 39 | void appendRemoved(QPieSlice* slice); |
|
38 | 40 | |
|
39 | 41 | QList<QPieSlice*> added() const; |
|
40 | 42 | QList<QPieSlice*> changed() const; |
|
41 | 43 | QList<QPieSlice*> removed() const; |
|
42 | 44 | |
|
43 | 45 | bool isEmpty() const; |
|
44 | 46 | |
|
45 | 47 | private: |
|
46 | 48 | QList<QPieSlice*> m_added; |
|
47 | 49 | QList<QPieSlice*> m_changed; |
|
48 | 50 | QList<QPieSlice*> m_removed; |
|
49 | 51 | }; |
|
50 | 52 | |
|
51 | 53 | public: |
|
52 | 54 | QPieSeries(QObject *parent = 0); |
|
53 | 55 | virtual ~QPieSeries(); |
|
54 | 56 | |
|
55 | 57 | public: // from QChartSeries |
|
56 |
QChartSeriesType type() const |
|
|
58 | QChartSeriesType type() const; | |
|
57 | 59 | virtual bool setData(QList<qreal> data); // TODO: remove this |
|
58 | 60 | |
|
59 | 61 | public: |
|
60 | 62 | void set(QList<QPieSlice*> slices); |
|
61 | 63 | void add(QList<QPieSlice*> slices); |
|
62 | 64 | void add(QPieSlice* slice); |
|
63 | 65 | QPieSlice* add(qreal value, QString name); |
|
64 | 66 | void remove(QPieSlice* slice); |
|
65 | 67 | void clear(); |
|
66 | 68 | |
|
67 |
int count() const |
|
|
69 | int count() const; | |
|
68 | 70 | |
|
69 |
QList<QPieSlice*> slices() const |
|
|
71 | QList<QPieSlice*> slices() const; | |
|
70 | 72 | |
|
71 | 73 | void setSizeFactor(qreal sizeFactor); |
|
72 |
qreal sizeFactor() const |
|
|
74 | qreal sizeFactor() const; | |
|
73 | 75 | |
|
74 | 76 | void setPosition(PiePosition position); |
|
75 |
PiePosition position() const |
|
|
77 | PiePosition position() const; | |
|
76 | 78 | |
|
77 |
void setSpan(qreal startAngle, qreal |
|
|
79 | void setSpan(qreal startAngle, qreal angleSpan); | |
|
78 | 80 | |
|
79 | 81 | void setLabelsVisible(bool visible); |
|
80 | 82 | void enableClickExplodes(bool enable); |
|
81 | 83 | void enableHoverHighlight(bool enable); |
|
82 | 84 | |
|
83 | 85 | // TODO: find slices? |
|
84 | 86 | // QList<QPieSlice*> findByValue(qreal value); |
|
85 | 87 | // ... |
|
86 | 88 | |
|
87 | 89 | // TODO: sorting slices? |
|
88 | 90 | // void sort(QPieSeries::SortByValue|label|??) |
|
89 | 91 | |
|
90 | 92 | // TODO: general graphics customization |
|
91 | 93 | // setDrawStyle(2d|3d) |
|
92 | 94 | // setDropShadows(bool) |
|
93 | 95 | |
|
94 | 96 | Q_SIGNALS: |
|
95 | 97 | void changed(const QPieSeries::ChangeSet& changeSet); |
|
96 | 98 | void clicked(QPieSlice* slice); |
|
97 | 99 | void hoverEnter(QPieSlice* slice); |
|
98 | 100 | void hoverLeave(QPieSlice* slice); |
|
99 | 101 | void sizeFactorChanged(); |
|
100 | 102 | void positionChanged(); |
|
101 | 103 | |
|
102 | 104 | private Q_SLOTS: // TODO: should be private and not visible in the interface at all |
|
103 | 105 | void sliceChanged(); |
|
104 | 106 | void sliceClicked(); |
|
105 | 107 | void sliceHoverEnter(); |
|
106 | 108 | void sliceHoverLeave(); |
|
107 | 109 | void toggleExploded(QPieSlice* slice); |
|
108 | 110 | void highlightOn(QPieSlice* slice); |
|
109 | 111 | void highlightOff(QPieSlice* slice); |
|
110 | 112 | |
|
111 | 113 | private: |
|
112 | 114 | void updateDerivativeData(); |
|
113 | 115 | |
|
114 | 116 | private: |
|
115 | 117 | Q_DISABLE_COPY(QPieSeries) |
|
116 | 118 | |
|
117 | 119 | // TODO: use PIML |
|
118 | 120 | friend class PiePresenter; |
|
119 | 121 | friend class PieSlice; |
|
120 | 122 | |
|
121 | 123 | QList<QPieSlice*> m_slices; |
|
122 | 124 | qreal m_sizeFactor; |
|
123 | 125 | PiePosition m_position; |
|
124 | 126 | qreal m_total; |
|
125 | 127 | qreal m_pieStartAngle; |
|
126 | qreal m_pieSpan; | |
|
128 | qreal m_pieAngleSpan; | |
|
127 | 129 | }; |
|
128 | 130 | |
|
129 | 131 | QTCOMMERCIALCHART_END_NAMESPACE |
|
130 | 132 | |
|
131 | 133 | #endif // PIESERIES_H |
@@ -1,197 +1,361 | |||
|
1 | 1 | #include "qpieslice.h" |
|
2 | 2 | |
|
3 | 3 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
4 | 4 | |
|
5 | 5 | #define DEFAULT_PEN_COLOR Qt::black |
|
6 | 6 | #define DEFAULT_BRUSH_COLOR Qt::white |
|
7 |
#define DEFAULT_LABEL_ARM_LENGTH |
|
|
7 | #define DEFAULT_LABEL_ARM_LENGTH 40 | |
|
8 | 8 | #define DEFAULT_EXPOLODE_DISTANCE 20 |
|
9 | 9 | |
|
10 | /*! | |
|
11 | \class QPieSlice | |
|
12 | \brief QtCommercial charts pie series API. | |
|
13 | ||
|
14 | */ | |
|
15 | ||
|
16 | /*! | |
|
17 | \property QPieSlice::label | |
|
18 | ||
|
19 | Label of the slice. | |
|
20 | */ | |
|
21 | ||
|
22 | /*! | |
|
23 | \property QPieSlice::value | |
|
24 | ||
|
25 | Value of the slice. | |
|
26 | */ | |
|
27 | ||
|
28 | /*! | |
|
29 | Constructs an empty slice with a \a parent. | |
|
30 | Note that QPieSeries takes ownership of the slice when it is set/added. | |
|
31 | \sa QPieSeries::set(), QPieSeries::add() | |
|
32 | */ | |
|
10 | 33 | QPieSlice::QPieSlice(QObject *parent) |
|
11 | 34 | :QObject(parent), |
|
12 | 35 | m_value(0), |
|
13 | 36 | m_isLabelVisible(false), |
|
14 | 37 | m_isExploded(false), |
|
15 | 38 | m_explodeDistance(DEFAULT_EXPOLODE_DISTANCE), |
|
16 | 39 | m_percentage(0), |
|
17 | 40 | m_angle(0), |
|
18 | 41 | m_angleSpan(0), |
|
19 | 42 | m_pen(DEFAULT_PEN_COLOR), |
|
20 | 43 | m_brush(DEFAULT_BRUSH_COLOR), |
|
21 | 44 | m_labelPen(DEFAULT_PEN_COLOR), |
|
22 | 45 | m_labelArmLength(DEFAULT_LABEL_ARM_LENGTH) |
|
23 | 46 | { |
|
24 | 47 | |
|
25 | 48 | } |
|
26 | 49 | |
|
27 | QPieSlice::QPieSlice(qreal value, QString label, bool labelVisible, QObject *parent) | |
|
50 | /*! | |
|
51 | Constructs an empty slice with given \a value, \a label and a \a parent. | |
|
52 | Note that QPieSeries takes ownership of the slice when it is set/added. | |
|
53 | \sa QPieSeries::set(), QPieSeries::add() | |
|
54 | */ | |
|
55 | QPieSlice::QPieSlice(qreal value, QString label, QObject *parent) | |
|
28 | 56 | :QObject(parent), |
|
29 | 57 | m_value(value), |
|
30 | 58 | m_label(label), |
|
31 |
m_isLabelVisible( |
|
|
59 | m_isLabelVisible(false), | |
|
32 | 60 | m_isExploded(false), |
|
33 | 61 | m_explodeDistance(DEFAULT_EXPOLODE_DISTANCE), |
|
34 | 62 | m_percentage(0), |
|
35 | 63 | m_angle(0), |
|
36 | 64 | m_angleSpan(0), |
|
37 | 65 | m_pen(DEFAULT_PEN_COLOR), |
|
38 | 66 | m_brush(DEFAULT_BRUSH_COLOR), |
|
39 | 67 | m_labelPen(DEFAULT_PEN_COLOR), |
|
40 | 68 | m_labelArmLength(DEFAULT_LABEL_ARM_LENGTH) |
|
41 | 69 | { |
|
42 | 70 | |
|
43 | 71 | } |
|
44 | 72 | |
|
73 | /*! | |
|
74 | Destroys the slice. | |
|
75 | User should not delete the slice if it has been added to the series. | |
|
76 | */ | |
|
45 | 77 | QPieSlice::~QPieSlice() |
|
46 | 78 | { |
|
47 | 79 | |
|
48 | 80 | } |
|
49 | 81 | |
|
82 | /*! | |
|
83 | Gets the value of the slice. | |
|
84 | Note that all values in the series | |
|
85 | \sa setValue() | |
|
86 | */ | |
|
50 | 87 | qreal QPieSlice::value() const |
|
51 | 88 | { |
|
52 | 89 | return m_value; |
|
53 | 90 | } |
|
54 | 91 | |
|
92 | /*! | |
|
93 | Gets the label of the slice. | |
|
94 | \sa setLabel() | |
|
95 | */ | |
|
55 | 96 | QString QPieSlice::label() const |
|
56 | 97 | { |
|
57 | 98 | return m_label; |
|
58 | 99 | } |
|
59 | 100 | |
|
101 | /*! | |
|
102 | Returns true if label is set as visible. | |
|
103 | \sa setLabelVisible() | |
|
104 | */ | |
|
60 | 105 | bool QPieSlice::isLabelVisible() const |
|
61 | 106 | { |
|
62 | 107 | return m_isLabelVisible; |
|
63 | 108 | } |
|
64 | 109 | |
|
110 | /*! | |
|
111 | Returns true if slice is exloded from the pie. | |
|
112 | \sa setExploded() | |
|
113 | */ | |
|
65 | 114 | bool QPieSlice::isExploded() const |
|
66 | 115 | { |
|
67 | 116 | return m_isExploded; |
|
68 | 117 | } |
|
69 | 118 | |
|
119 | /*! | |
|
120 | Returns the explosion distance of the slice. | |
|
121 | Default value is 20. | |
|
122 | \sa setExplodeDistance() | |
|
123 | */ | |
|
70 | 124 | qreal QPieSlice::explodeDistance() const |
|
71 | 125 | { |
|
72 | 126 | return m_explodeDistance; |
|
73 | 127 | } |
|
74 | 128 | |
|
129 | /*! | |
|
130 | Returns the percentage of this slice compared to all slices in the same series. | |
|
131 | Updated internally after the slice is added to the series. | |
|
132 | */ | |
|
75 | 133 | qreal QPieSlice::percentage() const |
|
76 | 134 | { |
|
77 | 135 | return m_percentage; |
|
78 | 136 | } |
|
79 | 137 | |
|
138 | /*! | |
|
139 | Returns the starting angle of this slice in the series it belongs to. | |
|
140 | Updated internally after the slice is added to the series. | |
|
141 | */ | |
|
80 | 142 | qreal QPieSlice::angle() const |
|
81 | 143 | { |
|
82 | 144 | return m_angle; |
|
83 | 145 | } |
|
84 | 146 | |
|
147 | /*! | |
|
148 | Returns the angle span of this slice in the series it belongs to. | |
|
149 | Updated internally after the slice is added to the series. | |
|
150 | */ | |
|
85 | 151 | qreal QPieSlice::angleSpan() const |
|
86 | 152 | { |
|
87 | 153 | return m_angleSpan; |
|
88 | 154 | } |
|
89 | 155 | |
|
156 | /*! | |
|
157 | Returns the pen used to draw this slice. | |
|
158 | \sa setPen() | |
|
159 | */ | |
|
90 | 160 | QPen QPieSlice::pen() const |
|
91 | 161 | { |
|
92 | 162 | return m_pen; |
|
93 | 163 | } |
|
94 | 164 | |
|
165 | /*! | |
|
166 | Returns the brush used to draw this slice. | |
|
167 | \sa setBrush() | |
|
168 | */ | |
|
95 | 169 | QBrush QPieSlice::brush() const |
|
96 | 170 | { |
|
97 | 171 | return m_brush; |
|
98 | 172 | } |
|
99 | 173 | |
|
174 | /*! | |
|
175 | Returns the pen used to draw label in this slice. | |
|
176 | \sa setLabelPen() | |
|
177 | */ | |
|
100 | 178 | QPen QPieSlice::labelPen() const |
|
101 | 179 | { |
|
102 | 180 | return m_labelPen; |
|
103 | 181 | } |
|
104 | 182 | |
|
183 | /*! | |
|
184 | Returns the font used to draw label in this slice. | |
|
185 | \sa setLabelFont() | |
|
186 | */ | |
|
105 | 187 | QFont QPieSlice::labelFont() const |
|
106 | 188 | { |
|
107 | 189 | return m_labelFont; |
|
108 | 190 | } |
|
109 | 191 | |
|
192 | /*! | |
|
193 | Returns the label arm lenght used in this slice. | |
|
194 | Default value is 40 pixels. | |
|
195 | \sa setLabelArmLength() | |
|
196 | */ | |
|
110 | 197 | qreal QPieSlice::labelArmLength() const |
|
111 | 198 | { |
|
112 | 199 | return m_labelArmLength; |
|
113 | 200 | } |
|
114 | 201 | |
|
202 | /*! | |
|
203 | \fn void QPieSlice::clicked() | |
|
204 | ||
|
205 | This signal is emitted when user has clicked the slice. | |
|
206 | ||
|
207 | \sa QPieSeries::clicked() | |
|
208 | */ | |
|
209 | ||
|
210 | /*! | |
|
211 | \fn void QPieSlice::hoverEnter() | |
|
212 | ||
|
213 | This signal is emitted when user has hovered over the slice. | |
|
214 | ||
|
215 | \sa QPieSeries::hoverEnter() | |
|
216 | */ | |
|
217 | ||
|
218 | /*! | |
|
219 | \fn void QPieSlice::hoverLeave() | |
|
220 | ||
|
221 | This signal is emitted when user has hovered away from the slice. | |
|
222 | ||
|
223 | \sa QPieSeries::hoverLeave() | |
|
224 | */ | |
|
225 | ||
|
226 | /*! | |
|
227 | \fn void QPieSlice::changed() | |
|
228 | ||
|
229 | This signal emitted when something has changed in the slice. | |
|
230 | ||
|
231 | \sa QPieSeries::changed() | |
|
232 | */ | |
|
233 | ||
|
234 | /*! | |
|
235 | Sets the value of this slice. | |
|
236 | \sa value() | |
|
237 | */ | |
|
115 | 238 | void QPieSlice::setValue(qreal value) |
|
116 | 239 | { |
|
117 | 240 | if (m_value != value) { |
|
118 | 241 | m_value = value; |
|
119 | 242 | emit changed(); |
|
120 | 243 | } |
|
121 | 244 | } |
|
122 | 245 | |
|
246 | /*! | |
|
247 | Sets the \a label of the slice. | |
|
248 | \sa label() | |
|
249 | */ | |
|
123 | 250 | void QPieSlice::setLabel(QString label) |
|
124 | 251 | { |
|
125 | 252 | if (m_label != label) { |
|
126 | 253 | m_label = label; |
|
127 | 254 | emit changed(); |
|
128 | 255 | } |
|
129 | 256 | } |
|
130 | 257 | |
|
258 | /*! | |
|
259 | Sets the label \a visible in this slice. | |
|
260 | \sa isLabelVisible(), QPieSeries::setLabelsVisible() | |
|
261 | */ | |
|
131 | 262 | void QPieSlice::setLabelVisible(bool visible) |
|
132 | 263 | { |
|
133 | 264 | if (m_isLabelVisible != visible) { |
|
134 | 265 | m_isLabelVisible = visible; |
|
135 | 266 | emit changed(); |
|
136 | 267 | } |
|
137 | 268 | } |
|
138 | 269 | |
|
270 | /*! | |
|
271 | Sets this slice \a exploded. | |
|
272 | \sa isExploded(), setExplodeDistance(), QPieSeries::enableClickExplodes() | |
|
273 | */ | |
|
139 | 274 | void QPieSlice::setExploded(bool exploded) |
|
140 | 275 | { |
|
141 | 276 | if (m_isExploded != exploded) { |
|
142 | 277 | m_isExploded = exploded; |
|
143 | 278 | emit changed(); |
|
144 | 279 | } |
|
145 | 280 | } |
|
146 | 281 | |
|
282 | /*! | |
|
283 | Sets the explosion \a distance of this slice. | |
|
284 | It is the distance the slice is moved away from the pie center. | |
|
285 | \sa explodeDistance(), isExploded(), QPieSeries::enableClickExplodes() | |
|
286 | */ | |
|
147 | 287 | void QPieSlice::setExplodeDistance(qreal distance) |
|
148 | 288 | { |
|
149 | 289 | if (m_explodeDistance != distance) { |
|
150 | 290 | m_explodeDistance = distance; |
|
151 | 291 | emit changed(); |
|
152 | 292 | } |
|
153 | 293 | } |
|
154 | 294 | |
|
295 | /*! | |
|
296 | Sets the \a pen used to draw this slice. | |
|
297 | Note that applying a theme will override this. | |
|
298 | \sa pen() | |
|
299 | */ | |
|
155 | 300 | void QPieSlice::setPen(QPen pen) |
|
156 | 301 | { |
|
157 | 302 | if (m_pen != pen) { |
|
158 | 303 | m_pen = pen; |
|
159 | 304 | emit changed(); |
|
160 | 305 | } |
|
161 | 306 | } |
|
162 | 307 | |
|
308 | /*! | |
|
309 | Sets the \a brush used to draw this slice. | |
|
310 | Note that applying a theme will override this. | |
|
311 | \sa brush() | |
|
312 | */ | |
|
163 | 313 | void QPieSlice::setBrush(QBrush brush) |
|
164 | 314 | { |
|
165 | 315 | if (m_brush != brush) { |
|
166 | 316 | m_brush = brush; |
|
167 | 317 | emit changed(); |
|
168 | 318 | } |
|
169 | 319 | } |
|
170 | 320 | |
|
171 | void QPieSlice::setLabelFont(QFont font) | |
|
321 | /*! | |
|
322 | Sets the \a pen used to draw the label in this slice. | |
|
323 | Note that applying a theme will override this. | |
|
324 | \sa labelPen() | |
|
325 | */ | |
|
326 | void QPieSlice::setLabelPen(QPen pen) | |
|
172 | 327 | { |
|
173 |
if (m_label |
|
|
174 |
m_label |
|
|
328 | if (m_labelPen != pen) { | |
|
329 | m_labelPen = pen; | |
|
175 | 330 | emit changed(); |
|
176 | 331 | } |
|
177 | 332 | } |
|
178 | 333 | |
|
179 | void QPieSlice::setLabelPen(QPen pen) | |
|
334 | /*! | |
|
335 | Sets the \a font used to draw the label in this slice. | |
|
336 | Note that applying a theme will override this. | |
|
337 | \sa labelFont() | |
|
338 | */ | |
|
339 | void QPieSlice::setLabelFont(QFont font) | |
|
180 | 340 | { |
|
181 |
if (m_label |
|
|
182 |
m_label |
|
|
341 | if (m_labelFont != font) { | |
|
342 | m_labelFont = font; | |
|
183 | 343 | emit changed(); |
|
184 | 344 | } |
|
185 | 345 | } |
|
186 | 346 | |
|
187 | void QPieSlice::setLabelArmLength(qreal len) | |
|
347 | /*! | |
|
348 | Sets the label arm \a length used to draw the label in this slice. | |
|
349 | \sa labelArmLength() | |
|
350 | */ | |
|
351 | void QPieSlice::setLabelArmLength(qreal length) | |
|
188 | 352 | { |
|
189 | if (m_labelArmLength != len) { | |
|
190 | m_labelArmLength = len; | |
|
353 | if (m_labelArmLength != length) { | |
|
354 | m_labelArmLength = length; | |
|
191 | 355 | emit changed(); |
|
192 | 356 | } |
|
193 | 357 | } |
|
194 | 358 | |
|
195 | 359 | #include "moc_qpieslice.cpp" |
|
196 | 360 | |
|
197 | 361 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,96 +1,96 | |||
|
1 | 1 | #ifndef QPIESLICE_H |
|
2 | 2 | #define QPIESLICE_H |
|
3 | 3 | |
|
4 | 4 | #include <qchartglobal.h> |
|
5 | 5 | #include <QObject> |
|
6 | 6 | #include <QPen> |
|
7 | 7 | #include <QBrush> |
|
8 | 8 | #include <QFont> |
|
9 | 9 | |
|
10 | 10 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
11 | 11 | |
|
12 | 12 | class QTCOMMERCIALCHART_EXPORT QPieSlice : public QObject |
|
13 | 13 | { |
|
14 | 14 | Q_OBJECT |
|
15 |
Q_PROPERTY(QString label READ label WRITE setLabel |
|
|
16 |
Q_PROPERTY(qreal value READ value WRITE setValue |
|
|
15 | Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY changed) | |
|
16 | Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY changed) | |
|
17 | 17 | |
|
18 | 18 | public: |
|
19 | 19 | QPieSlice(QObject *parent = 0); |
|
20 |
QPieSlice(qreal value, QString label, |
|
|
20 | QPieSlice(qreal value, QString label, QObject *parent = 0); | |
|
21 | 21 | virtual ~QPieSlice(); |
|
22 | 22 | |
|
23 | 23 | // data |
|
24 | 24 | qreal value() const; |
|
25 | 25 | QString label() const; |
|
26 | 26 | bool isLabelVisible() const; |
|
27 | 27 | bool isExploded() const; |
|
28 | 28 | qreal explodeDistance() const; |
|
29 | 29 | |
|
30 | 30 | // generated data |
|
31 | 31 | qreal percentage() const; |
|
32 | 32 | qreal angle() const; |
|
33 | 33 | qreal angleSpan() const; |
|
34 | 34 | |
|
35 | 35 | // customization |
|
36 | 36 | QPen pen() const; |
|
37 | 37 | QBrush brush() const; |
|
38 | 38 | QPen labelPen() const; |
|
39 | 39 | QFont labelFont() const; |
|
40 | 40 | qreal labelArmLength() const; |
|
41 | 41 | |
|
42 | 42 | Q_SIGNALS: |
|
43 | 43 | void clicked(); |
|
44 | 44 | void hoverEnter(); |
|
45 | 45 | void hoverLeave(); |
|
46 | 46 | void changed(); |
|
47 | 47 | |
|
48 | 48 | public Q_SLOTS: |
|
49 | 49 | |
|
50 | 50 | // data |
|
51 | 51 | void setLabel(QString label); |
|
52 | 52 | void setLabelVisible(bool visible); |
|
53 | 53 | void setValue(qreal value); |
|
54 | 54 | void setExploded(bool exploded); |
|
55 | 55 | void setExplodeDistance(qreal distance); |
|
56 | 56 | |
|
57 | 57 | // customization |
|
58 | 58 | void setPen(QPen pen); |
|
59 | 59 | void setBrush(QBrush brush); |
|
60 | 60 | void setLabelFont(QFont font); |
|
61 | 61 | void setLabelPen(QPen pen); |
|
62 | 62 | void setLabelArmLength(qreal len); |
|
63 | 63 | |
|
64 | 64 | // TODO: label position in general |
|
65 | 65 | // setLabelFlags(inside|outside|labelArmOn|labelArmOff|???) |
|
66 | 66 | // setLabelOrientation(horizontal|vertical|same as slice center angle|???) |
|
67 | 67 | |
|
68 | 68 | private: |
|
69 | 69 | |
|
70 | 70 | // TODO: use private class |
|
71 | 71 | friend class QPieSeries; |
|
72 | 72 | friend class PiePresenter; |
|
73 | 73 | |
|
74 | 74 | // data |
|
75 | 75 | qreal m_value; |
|
76 | 76 | QString m_label; |
|
77 | 77 | bool m_isLabelVisible; |
|
78 | 78 | bool m_isExploded; |
|
79 | 79 | qreal m_explodeDistance; |
|
80 | 80 | |
|
81 | 81 | // generated data |
|
82 | 82 | qreal m_percentage; |
|
83 | 83 | qreal m_angle; |
|
84 | 84 | qreal m_angleSpan; |
|
85 | 85 | |
|
86 | 86 | // customization |
|
87 | 87 | QPen m_pen; |
|
88 | 88 | QBrush m_brush; |
|
89 | 89 | QPen m_labelPen; |
|
90 | 90 | QFont m_labelFont; |
|
91 | 91 | qreal m_labelArmLength; |
|
92 | 92 | }; |
|
93 | 93 | |
|
94 | 94 | QTCOMMERCIALCHART_END_NAMESPACE |
|
95 | 95 | |
|
96 | 96 | #endif // QPIESLICE_H |
General Comments 0
You need to be logged in to leave comments.
Login now