##// END OF EJS Templates
Fix issues with pen/brush convenience properties and update docs
Jani Honkonen -
r1338:12de1da93c51
parent child
Show More
@@ -121,6 +121,42 QTCOMMERCIALCHART_BEGIN_NAMESPACE
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.
@@ -135,6 +171,24 QTCOMMERCIALCHART_BEGIN_NAMESPACE
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.
@@ -151,6 +205,24 QTCOMMERCIALCHART_BEGIN_NAMESPACE
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.
@@ -381,6 +453,34 QPen QPieSlice::pen() const
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);
@@ -391,6 +491,20 QBrush QPieSlice::brush() const
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);
@@ -401,6 +515,20 QBrush QPieSlice::labelBrush() const
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);
@@ -452,63 +580,6 qreal QPieSlice::angleSpan() const
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
@@ -540,35 +611,47 QPieSlicePrivate *QPieSlicePrivate::fromSlice(QPieSlice *slice)
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
@@ -39,18 +39,18 class QTCOMMERCIALCHART_EXPORT QPieSlice : public QObject
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);
@@ -72,12 +72,24 public:
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
@@ -91,15 +103,6 public:
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:
General Comments 0
You need to be logged in to leave comments. Login now