##// END OF EJS Templates
Fix issues with pen/brush convenience properties and update docs
Jani Honkonen -
r1338:12de1da93c51
parent child
Show More
@@ -1,612 +1,695
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 "qpieslice.h"
22 22 #include "qpieslice_p.h"
23 23
24 24 QTCOMMERCIALCHART_BEGIN_NAMESPACE
25 25
26 26 /*!
27 27 \class QPieSlice
28 28 \brief Defines a slice in pie series.
29 29
30 30 This object defines the properties of a single slice in a QPieSeries.
31 31
32 32 In addition to the obvious value and label properties the user can also control
33 33 the visual appearance of a slice. By modifying the visual appearance also means that
34 34 the user is overriding the default appearance set by the theme.
35 35
36 36 Note that if the user has customized slices and theme is changed all customizations will be lost.
37 37
38 38 To enable user interaction with the pie some basic signals are provided about clicking and hovering.
39 39 */
40 40
41 41 /*!
42 42 \property QPieSlice::label
43 43
44 44 Label of the slice.
45 45
46 46 \sa labelVisible, labelBrush, labelFont, labelArmLengthFactor
47 47 */
48 48
49 49 /*!
50 50 \fn void QPieSlice::labelChanged()
51 51
52 52 This signal emitted when the slice label has been changed.
53 53
54 54 \sa label
55 55 */
56 56
57 57 /*!
58 58 \property QPieSlice::value
59 59
60 60 Value of the slice.
61 61
62 62 Note that if users sets a negative value it is converted to a positive value.
63 63
64 64 \sa percentage(), QPieSeries::sum()
65 65 */
66 66
67 67 /*!
68 68 \fn void QPieSlice::valueChanged()
69 69
70 70 This signal is emitted when the slice value changes.
71 71
72 72 \sa value
73 73 */
74 74
75 75 /*!
76 76 \property QPieSlice::labelVisible
77 77
78 78 Defienes the visibility of the slice label.
79 79
80 80 Default is not visible.
81 81
82 82 \sa label, labelBrush, labelFont, labelArmLengthFactor
83 83 */
84 84
85 85 /*!
86 86 \fn void QPieSlice::labelVisibleChanged()
87 87
88 88 This signal emitted when visibility of the slice label has changed.
89 89
90 90 \sa labelVisible
91 91 */
92 92
93 93 /*!
94 94 \property QPieSlice::exploded
95 95
96 96 Defines if the slice is exploded from the pie.
97 97
98 98 \sa explodeDistanceFactor
99 99 */
100 100
101 101 /*!
102 102 \fn void QPieSlice::explodedChanged()
103 103
104 104 This signal is emitted the the slice has been exploded from the pie or is returned back to the pie.
105 105
106 106 \sa exploded
107 107 */
108 108
109 109 /*!
110 110 \property QPieSlice::pen
111 111
112 112 Pen used to draw the slice border.
113 113 */
114 114
115 115 /*!
116 116 \fn void QPieSlice::penChanged()
117 117
118 118 This signal is emitted when the pen of the slice has changed.
119 119
120 120 \sa pen
121 121 */
122 122
123 123 /*!
124 \property QPieSlice::borderColor
125
126 Color used to draw the slice border.
127
128 This is a convenience property for modifying the slice pen.
129
130 \sa pen, borderWidth
131 */
132
133 /*!
134 \fn void QPieSlice::borderColorChanged()
135
136 This signal is emitted when slice border color changes.
137
138 \sa pen, borderColor
139 */
140
141 /*!
142 \property QPieSlice::borderWidth
143
144 Width of the slice border.
145
146 This is a convenience property for modifying the slice pen.
147
148 \sa pen, borderColor
149 */
150
151 /*!
152 \fn void QPieSlice::borderWidthChanged()
153
154 This signal is emitted when slice border width changes.
155
156 \sa pen, borderWidth
157 */
158
159 /*!
124 160 \property QPieSlice::brush
125 161
126 162 Brush used to draw the slice.
127 163 */
128 164
129 165 /*!
130 166 \fn void QPieSlice::brushChanged()
131 167
132 168 This signal is emitted when the brush of the slice has changed.
133 169
134 170 \sa brush
135 171 */
136 172
137 173 /*!
174 \property QPieSlice::color
175
176 Color used to draw the slice.
177
178 This is a convenience property for modifying the slice brush.
179
180 \sa brush
181 */
182
183 /*!
184 \fn void QPieSlice::colorChanged()
185
186 This signal is emitted when slice color changes.
187
188 \sa brush
189 */
190
191 /*!
138 192 \property QPieSlice::labelBrush
139 193
140 194 Pen used to draw label and label arm of the slice.
141 195
142 196 \sa label, labelVisible, labelFont, labelArmLengthFactor
143 197 */
144 198
145 199 /*!
146 200 \fn void QPieSlice::labelBrushChanged()
147 201
148 202 This signal is emitted when the label pen of the slice has changed.
149 203
150 204 \sa labelBrush
151 205 */
152 206
153 207 /*!
208 \property QPieSlice::labelColor
209
210 Color used to draw the slice label.
211
212 This is a convenience property for modifying the slice label brush.
213
214 \sa labelBrush
215 */
216
217 /*!
218 \fn void QPieSlice::labelColorChanged()
219
220 This signal is emitted when slice label color changes.
221
222 \sa labelColor
223 */
224
225 /*!
154 226 \property QPieSlice::labelFont
155 227
156 228 Font used for drawing label text.
157 229
158 230 \sa label, labelVisible, labelArmLengthFactor
159 231 */
160 232
161 233 /*!
162 234 \fn void QPieSlice::labelFontChanged()
163 235
164 236 This signal is emitted when the label font of the slice has changed.
165 237
166 238 \sa labelFont
167 239 */
168 240
169 241 /*!
170 242 \property QPieSlice::labelArmLengthFactor
171 243
172 244 Defines the length of the label arm.
173 245
174 246 The factor is relative to pie radius. For example:
175 247 1.0 means the length is the same as the radius.
176 248 0.5 means the length is half of the radius.
177 249
178 250 Default value is 0.15
179 251
180 252 \sa label, labelVisible, labelBrush, labelFont
181 253 */
182 254
183 255 /*!
184 256 \fn void QPieSlice::labelArmLengthFactorChanged()
185 257
186 258 This signal is emitted when the label arm factor of the slice has changed.
187 259
188 260 \sa labelArmLengthFactor
189 261 */
190 262
191 263 /*!
192 264 \property QPieSlice::explodeDistanceFactor
193 265
194 266 When the slice is exploded this factor defines how far the slice is exploded away from the pie.
195 267
196 268 The factor is relative to pie radius. For example:
197 269 1.0 means the distance is the same as the radius.
198 270 0.5 means the distance is half of the radius.
199 271
200 272 Default value is 0.15
201 273
202 274 \sa exploded
203 275 */
204 276
205 277 /*!
206 278 \fn void QPieSlice::explodeDistanceFactorChanged()
207 279
208 280 This signal is emitted when the explode distance factor of the slice has changed.
209 281
210 282 \sa explodeDistanceFactor
211 283 */
212 284
213 285 /*!
214 286 \property QPieSlice::percentage
215 287
216 288 Percentage of the slice compared to the sum of all slices in the series.
217 289
218 290 The actual value ranges from 0.0 to 1.0.
219 291
220 292 Updated automatically once the slice is added to the series.
221 293
222 294 \sa value, QPieSeries::sum
223 295 */
224 296
225 297 /*!
226 298 \fn void QPieSlice::percentageChanged()
227 299
228 300 This signal is emitted when the percentage of the slice has changed.
229 301
230 302 \sa percentage
231 303 */
232 304
233 305 /*!
234 306 \property QPieSlice::startAngle
235 307
236 308 Defines the starting angle of this slice in the series it belongs to.
237 309
238 310 Full pie is 360 degrees where 0 degrees is at 12 a'clock.
239 311
240 312 Updated automatically once the slice is added to the series.
241 313 */
242 314
243 315 /*!
244 316 \fn void QPieSlice::startAngleChanged()
245 317
246 318 This signal is emitted when the starting angle f the slice has changed.
247 319
248 320 \sa startAngle
249 321 */
250 322
251 323 /*!
252 324 \property QPieSlice::angleSpan
253 325
254 326 Span of the slice in degrees.
255 327
256 328 Full pie is 360 degrees where 0 degrees is at 12 a'clock.
257 329
258 330 Updated automatically once the slice is added to the series.
259 331 */
260 332
261 333 /*!
262 334 \fn void QPieSlice::angleSpanChanged()
263 335
264 336 This signal is emitted when the angle span of the slice has changed.
265 337
266 338 \sa angleSpan
267 339 */
268 340
269 341
270 342 /*!
271 343 \fn void QPieSlice::clicked()
272 344
273 345 This signal is emitted when user has clicked the slice.
274 346
275 347 \sa QPieSeries::clicked()
276 348 */
277 349
278 350 /*!
279 351 \fn void QPieSlice::hovered(bool state)
280 352
281 353 This signal is emitted when user has hovered over or away from the slice.
282 354
283 355 \a state is true when user has hovered over the slice and false when hover has moved away from the slice.
284 356
285 357 \sa QPieSeries::hovered()
286 358 */
287 359
288 360 /*!
289 361 Constructs an empty slice with a \a parent.
290 362
291 363 \sa QPieSeries::append(), QPieSeries::insert()
292 364 */
293 365 QPieSlice::QPieSlice(QObject *parent)
294 366 :QObject(parent),
295 367 d_ptr(new QPieSlicePrivate(this))
296 368 {
297 369
298 370 }
299 371
300 372 /*!
301 373 Constructs an empty slice with given \a value, \a label and a \a parent.
302 374 \sa QPieSeries::append(), QPieSeries::insert()
303 375 */
304 376 QPieSlice::QPieSlice(QString label, qreal value, QObject *parent)
305 377 :QObject(parent),
306 378 d_ptr(new QPieSlicePrivate(this))
307 379 {
308 380 setValue(value);
309 381 setLabel(label);
310 382 }
311 383
312 384 /*!
313 385 Destroys the slice.
314 386 User should not delete the slice if it has been added to the series.
315 387 */
316 388 QPieSlice::~QPieSlice()
317 389 {
318 390
319 391 }
320 392
321 393 void QPieSlice::setLabel(QString label)
322 394 {
323 395 if (d_ptr->m_data.m_labelText != label) {
324 396 d_ptr->m_data.m_labelText = label;
325 397 emit labelChanged();
326 398 }
327 399 }
328 400
329 401 QString QPieSlice::label() const
330 402 {
331 403 return d_ptr->m_data.m_labelText;
332 404 }
333 405
334 406 void QPieSlice::setValue(qreal value)
335 407 {
336 408 value = qAbs(value); // negative values not allowed
337 409 if (!qFuzzyIsNull(d_ptr->m_data.m_value - value)) {
338 410 d_ptr->m_data.m_value = value;
339 411 emit valueChanged();
340 412 }
341 413 }
342 414
343 415 qreal QPieSlice::value() const
344 416 {
345 417 return d_ptr->m_data.m_value;
346 418 }
347 419
348 420 void QPieSlice::setLabelVisible(bool visible)
349 421 {
350 422 if (d_ptr->m_data.m_isLabelVisible != visible) {
351 423 d_ptr->m_data.m_isLabelVisible = visible;
352 424 emit labelVisibleChanged();
353 425 }
354 426 }
355 427
356 428 bool QPieSlice::isLabelVisible() const
357 429 {
358 430 return d_ptr->m_data.m_isLabelVisible;
359 431 }
360 432
361 433 void QPieSlice::setExploded(bool exploded)
362 434 {
363 435 if (d_ptr->m_data.m_isExploded != exploded) {
364 436 d_ptr->m_data.m_isExploded = exploded;
365 437 emit explodedChanged();
366 438 }
367 439 }
368 440
369 441 bool QPieSlice::isExploded() const
370 442 {
371 443 return d_ptr->m_data.m_isExploded;
372 444 }
373 445
374 446 void QPieSlice::setPen(const QPen &pen)
375 447 {
376 448 d_ptr->setPen(pen, false);
377 449 }
378 450
379 451 QPen QPieSlice::pen() const
380 452 {
381 453 return d_ptr->m_data.m_slicePen;
382 454 }
383 455
456 QColor QPieSlice::borderColor()
457 {
458 return pen().color();
459 }
460
461 void QPieSlice::setBorderColor(QColor color)
462 {
463 QPen p = pen();
464 if (color != p.color()) {
465 p.setColor(color);
466 setPen(p);
467 }
468 }
469
470 int QPieSlice::borderWidth()
471 {
472 return pen().width();
473 }
474
475 void QPieSlice::setBorderWidth(int width)
476 {
477 QPen p = pen();
478 if (width != p.width()) {
479 p.setWidth(width);
480 setPen(p);
481 }
482 }
483
384 484 void QPieSlice::setBrush(const QBrush &brush)
385 485 {
386 486 d_ptr->setBrush(brush, false);
387 487 }
388 488
389 489 QBrush QPieSlice::brush() const
390 490 {
391 491 return d_ptr->m_data.m_sliceBrush;
392 492 }
393 493
494 QColor QPieSlice::color()
495 {
496 return brush().color();
497 }
498
499 void QPieSlice::setColor(QColor color)
500 {
501 QBrush b = brush();
502 if (color != b.color()) {
503 b.setColor(color);
504 setBrush(b);
505 }
506 }
507
394 508 void QPieSlice::setLabelBrush(const QBrush &brush)
395 509 {
396 510 d_ptr->setLabelBrush(brush, false);
397 511 }
398 512
399 513 QBrush QPieSlice::labelBrush() const
400 514 {
401 515 return d_ptr->m_data.m_labelBrush;
402 516 }
403 517
518 QColor QPieSlice::labelColor()
519 {
520 return labelBrush().color();
521 }
522
523 void QPieSlice::setLabelColor(QColor color)
524 {
525 QBrush b = labelBrush();
526 if (color != b.color()) {
527 b.setColor(color);
528 setLabelBrush(b);
529 }
530 }
531
404 532 void QPieSlice::setLabelFont(const QFont &font)
405 533 {
406 534 d_ptr->setLabelFont(font, false);
407 535 }
408 536
409 537 QFont QPieSlice::labelFont() const
410 538 {
411 539 return d_ptr->m_data.m_labelFont;
412 540 }
413 541
414 542 void QPieSlice::setLabelArmLengthFactor(qreal factor)
415 543 {
416 544 if (!qFuzzyIsNull(d_ptr->m_data.m_labelArmLengthFactor - factor)) {
417 545 d_ptr->m_data.m_labelArmLengthFactor = factor;
418 546 emit labelArmLengthFactorChanged();
419 547 }
420 548 }
421 549
422 550 qreal QPieSlice::labelArmLengthFactor() const
423 551 {
424 552 return d_ptr->m_data.m_labelArmLengthFactor;
425 553 }
426 554
427 555 void QPieSlice::setExplodeDistanceFactor(qreal factor)
428 556 {
429 557 if (!qFuzzyIsNull(d_ptr->m_data.m_explodeDistanceFactor - factor)) {
430 558 d_ptr->m_data.m_explodeDistanceFactor = factor;
431 559 emit explodeDistanceFactorChanged();
432 560 }
433 561 }
434 562
435 563 qreal QPieSlice::explodeDistanceFactor() const
436 564 {
437 565 return d_ptr->m_data.m_explodeDistanceFactor;
438 566 }
439 567
440 568 qreal QPieSlice::percentage() const
441 569 {
442 570 return d_ptr->m_data.m_percentage;
443 571 }
444 572
445 573 qreal QPieSlice::startAngle() const
446 574 {
447 575 return d_ptr->m_data.m_startAngle;
448 576 }
449 577
450 578 qreal QPieSlice::angleSpan() const
451 579 {
452 580 return d_ptr->m_data.m_angleSpan;
453 581 }
454 582
455 QColor QPieSlice::color()
456 {
457 return brush().color();
458 }
459
460 void QPieSlice::setColor(QColor color)
461 {
462 QBrush b = brush();
463 if (color != b.color()) {
464 b.setColor(color);
465 setBrush(b);
466 }
467 }
468
469 QColor QPieSlice::borderColor()
470 {
471 return pen().color();
472 }
473
474 void QPieSlice::setBorderColor(QColor color)
475 {
476 QPen p = pen();
477 if (color != p.color()) {
478 p.setColor(color);
479 setPen(p);
480 emit borderColorChanged();
481 }
482 }
483
484 int QPieSlice::borderWidth()
485 {
486 return pen().width();
487 }
488
489 void QPieSlice::setBorderWidth(int width)
490 {
491 QPen p = pen();
492 if (width != p.width()) {
493 p.setWidth(width);
494 setPen(p);
495 }
496 }
497
498 QColor QPieSlice::labelColor()
499 {
500 return labelBrush().color();
501 }
502
503 void QPieSlice::setLabelColor(QColor color)
504 {
505 QBrush b = labelBrush();
506 if (color != b.color()) {
507 b.setColor(color);
508 setLabelBrush(b);
509 }
510 }
511
512 583 /*!
513 584 Returns the series that this slice belongs to.
514 585
515 586 \sa QPieSeries::append()
516 587 */
517 588 QPieSeries *QPieSlice::series() const
518 589 {
519 590 return d_ptr->m_series;
520 591 }
521 592
522 593 QPieSlicePrivate::QPieSlicePrivate(QPieSlice *parent)
523 594 :QObject(parent),
524 595 q_ptr(parent),
525 596 m_series(0)
526 597 {
527 598
528 599 }
529 600
530 601 QPieSlicePrivate::~QPieSlicePrivate()
531 602 {
532 603
533 604 }
534 605
535 606 QPieSlicePrivate *QPieSlicePrivate::fromSlice(QPieSlice *slice)
536 607 {
537 608 return slice->d_func();
538 609 }
539 610
540 611 void QPieSlicePrivate::setPen(const QPen &pen, bool themed)
541 612 {
542 613 if (m_data.m_slicePen != pen) {
543 if (m_data.m_slicePen.color() != pen.color())
544 emit q_ptr->borderColorChanged();
545 if (m_data.m_slicePen.width() != pen.width())
546 emit q_ptr->borderWidthChanged();
614
615 QPen oldPen = m_data.m_slicePen;
616
547 617 m_data.m_slicePen = pen;
548 618 m_data.m_slicePen.setThemed(themed);
619
549 620 emit q_ptr->penChanged();
621 if (oldPen.color() != pen.color())
622 emit q_ptr->borderColorChanged();
623 if (oldPen.width() != pen.width())
624 emit q_ptr->borderWidthChanged();
550 625 }
551 626 }
552 627
553 628 void QPieSlicePrivate::setBrush(const QBrush &brush, bool themed)
554 629 {
555 630 if (m_data.m_sliceBrush != brush) {
556 if (m_data.m_sliceBrush.color() != brush.color())
557 emit q_ptr->colorChanged();
631
632 QBrush oldBrush = m_data.m_sliceBrush;
633
558 634 m_data.m_sliceBrush = brush;
559 635 m_data.m_sliceBrush.setThemed(themed);
636
560 637 emit q_ptr->brushChanged();
638 if (oldBrush.color() != brush.color())
639 emit q_ptr->colorChanged();
561 640 }
562 641 }
563 642
564 643 void QPieSlicePrivate::setLabelBrush(const QBrush &brush, bool themed)
565 644 {
566 645 if (m_data.m_labelBrush != brush) {
567 if (m_data.m_labelBrush.color() != brush.color())
568 emit q_ptr->labelColorChanged();
646
647 QBrush oldBrush = m_data.m_labelBrush;
648
569 649 m_data.m_labelBrush = brush;
570 650 m_data.m_labelBrush.setThemed(themed);
651
571 652 emit q_ptr->labelBrushChanged();
653 if (oldBrush.color() != brush.color())
654 emit q_ptr->labelColorChanged();
572 655 }
573 656 }
574 657
575 658 void QPieSlicePrivate::setLabelFont(const QFont &font, bool themed)
576 659 {
577 660 if (m_data.m_labelFont != font) {
578 661 m_data.m_labelFont = font;
579 662 m_data.m_labelFont.setThemed(themed);
580 663 emit q_ptr->labelFontChanged();
581 664 }
582 665 }
583 666
584 667 void QPieSlicePrivate::setPercentage(qreal percentage)
585 668 {
586 669 if (!qFuzzyIsNull(m_data.m_percentage - percentage)) {
587 670 m_data.m_percentage = percentage;
588 671 emit q_ptr->percentageChanged();
589 672 }
590 673 }
591 674
592 675 void QPieSlicePrivate::setStartAngle(qreal angle)
593 676 {
594 677 if (!qFuzzyIsNull(m_data.m_startAngle - angle)) {
595 678 m_data.m_startAngle = angle;
596 679 emit q_ptr->startAngleChanged();
597 680 }
598 681 }
599 682
600 683 void QPieSlicePrivate::setAngleSpan(qreal span)
601 684 {
602 685 if (!qFuzzyIsNull(m_data.m_angleSpan - span)) {
603 686 m_data.m_angleSpan = span;
604 687 emit q_ptr->angleSpanChanged();
605 688 }
606 689 }
607 690
608 691 QTCOMMERCIALCHART_END_NAMESPACE
609 692
610 693 QTCOMMERCIALCHART_USE_NAMESPACE
611 694 #include "moc_qpieslice.cpp"
612 695 #include "moc_qpieslice_p.cpp"
@@ -1,134 +1,137
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 #ifndef QPIESLICE_H
22 22 #define QPIESLICE_H
23 23
24 24 #include <qchartglobal.h>
25 25 #include <QObject>
26 26 #include <QPen>
27 27 #include <QBrush>
28 28 #include <QFont>
29 29
30 30 QTCOMMERCIALCHART_BEGIN_NAMESPACE
31 31 class QPieSlicePrivate;
32 32 class QPieSeries;
33 33
34 34 class QTCOMMERCIALCHART_EXPORT QPieSlice : public QObject
35 35 {
36 36 Q_OBJECT
37 37 Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged)
38 38 Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged)
39 39 Q_PROPERTY(bool labelVisible READ isLabelVisible WRITE setLabelVisible NOTIFY labelVisibleChanged)
40 40 Q_PROPERTY(bool exploded READ isExploded WRITE setExploded NOTIFY explodedChanged)
41 41 Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged)
42 Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
43 Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged)
42 44 Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged)
45 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
43 46 Q_PROPERTY(QBrush labelBrush READ labelBrush WRITE setLabelBrush NOTIFY labelBrushChanged)
47 Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor NOTIFY labelColorChanged)
44 48 Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont NOTIFY labelFontChanged)
45 49 Q_PROPERTY(qreal labelArmLengthFactor READ labelArmLengthFactor WRITE setLabelArmLengthFactor)
46 50 Q_PROPERTY(qreal explodeDistanceFactor READ explodeDistanceFactor WRITE setExplodeDistanceFactor)
47 51 Q_PROPERTY(qreal percentage READ percentage NOTIFY percentageChanged)
48 52 Q_PROPERTY(qreal startAngle READ startAngle NOTIFY startAngleChanged)
49 53 Q_PROPERTY(qreal angleSpan READ angleSpan NOTIFY angleSpanChanged)
50 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
51 Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
52 Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged)
53 Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor NOTIFY labelColorChanged)
54 54
55 55 public:
56 56 explicit QPieSlice(QObject *parent = 0);
57 57 QPieSlice(QString label, qreal value, QObject *parent = 0);
58 58 virtual ~QPieSlice();
59 59
60 60 void setLabel(QString label);
61 61 QString label() const;
62 62
63 63 void setValue(qreal value);
64 64 qreal value() const;
65 65
66 66 void setLabelVisible(bool visible = true);
67 67 bool isLabelVisible() const;
68 68
69 69 void setExploded(bool exploded = true);
70 70 bool isExploded() const;
71 71
72 72 void setPen(const QPen &pen);
73 73 QPen pen() const;
74 74
75 QColor borderColor();
76 void setBorderColor(QColor color);
77
78 int borderWidth();
79 void setBorderWidth(int width);
80
75 81 void setBrush(const QBrush &brush);
76 82 QBrush brush() const;
77 83
84 QColor color();
85 void setColor(QColor color);
86
78 87 void setLabelBrush(const QBrush &brush);
79 88 QBrush labelBrush() const;
80 89
90 QColor labelColor();
91 void setLabelColor(QColor color);
92
81 93 void setLabelFont(const QFont &font);
82 94 QFont labelFont() const;
83 95
84 96 void setLabelArmLengthFactor(qreal factor);
85 97 qreal labelArmLengthFactor() const;
86 98
87 99 void setExplodeDistanceFactor(qreal factor);
88 100 qreal explodeDistanceFactor() const;
89 101
90 102 qreal percentage() const;
91 103 qreal startAngle() const;
92 104 qreal angleSpan() const;
93 105
94 QColor color();
95 void setColor(QColor color);
96 QColor borderColor();
97 void setBorderColor(QColor color);
98 int borderWidth();
99 void setBorderWidth(int width);
100 QColor labelColor();
101 void setLabelColor(QColor color);
102
103 106 QPieSeries *series() const;
104 107
105 108 Q_SIGNALS:
106 109 void labelChanged();
107 110 void valueChanged();
108 111 void labelVisibleChanged();
109 112 void explodedChanged();
110 113 void penChanged();
111 114 void brushChanged();
112 115 void labelBrushChanged();
113 116 void labelFontChanged();
114 117 void labelArmLengthFactorChanged();
115 118 void explodeDistanceFactorChanged();
116 119 void percentageChanged();
117 120 void startAngleChanged();
118 121 void angleSpanChanged();
119 122 void colorChanged();
120 123 void borderColorChanged();
121 124 void borderWidthChanged();
122 125 void labelColorChanged();
123 126 void clicked();
124 127 void hovered(bool state);
125 128
126 129 private:
127 130 QPieSlicePrivate * const d_ptr;
128 131 Q_DECLARE_PRIVATE(QPieSlice)
129 132 Q_DISABLE_COPY(QPieSlice)
130 133 };
131 134
132 135 QTCOMMERCIALCHART_END_NAMESPACE
133 136
134 137 #endif // QPIESLICE_H
General Comments 0
You need to be logged in to leave comments. Login now