@@ -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 | \property QPieSlice::brush |
|
160 | \property QPieSlice::brush | |
125 |
|
161 | |||
126 | Brush used to draw the slice. |
|
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 | \property QPieSlice::labelBrush |
|
192 | \property QPieSlice::labelBrush | |
139 |
|
193 | |||
140 | Pen used to draw label and label arm of the slice. |
|
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 | \property QPieSlice::labelFont |
|
226 | \property QPieSlice::labelFont | |
155 |
|
227 | |||
156 | Font used for drawing label text. |
|
228 | Font used for drawing label text. | |
@@ -381,6 +453,34 QPen QPieSlice::pen() const | |||||
381 | return d_ptr->m_data.m_slicePen; |
|
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 | void QPieSlice::setBrush(const QBrush &brush) |
|
484 | void QPieSlice::setBrush(const QBrush &brush) | |
385 | { |
|
485 | { | |
386 | d_ptr->setBrush(brush, false); |
|
486 | d_ptr->setBrush(brush, false); | |
@@ -391,6 +491,20 QBrush QPieSlice::brush() const | |||||
391 | return d_ptr->m_data.m_sliceBrush; |
|
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 | void QPieSlice::setLabelBrush(const QBrush &brush) |
|
508 | void QPieSlice::setLabelBrush(const QBrush &brush) | |
395 | { |
|
509 | { | |
396 | d_ptr->setLabelBrush(brush, false); |
|
510 | d_ptr->setLabelBrush(brush, false); | |
@@ -401,6 +515,20 QBrush QPieSlice::labelBrush() const | |||||
401 | return d_ptr->m_data.m_labelBrush; |
|
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 | void QPieSlice::setLabelFont(const QFont &font) |
|
532 | void QPieSlice::setLabelFont(const QFont &font) | |
405 | { |
|
533 | { | |
406 | d_ptr->setLabelFont(font, false); |
|
534 | d_ptr->setLabelFont(font, false); | |
@@ -452,63 +580,6 qreal QPieSlice::angleSpan() const | |||||
452 | return d_ptr->m_data.m_angleSpan; |
|
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 | Returns the series that this slice belongs to. |
|
584 | Returns the series that this slice belongs to. | |
514 |
|
585 | |||
@@ -540,35 +611,47 QPieSlicePrivate *QPieSlicePrivate::fromSlice(QPieSlice *slice) | |||||
540 | void QPieSlicePrivate::setPen(const QPen &pen, bool themed) |
|
611 | void QPieSlicePrivate::setPen(const QPen &pen, bool themed) | |
541 | { |
|
612 | { | |
542 | if (m_data.m_slicePen != pen) { |
|
613 | if (m_data.m_slicePen != pen) { | |
543 | if (m_data.m_slicePen.color() != pen.color()) |
|
614 | ||
544 | emit q_ptr->borderColorChanged(); |
|
615 | QPen oldPen = m_data.m_slicePen; | |
545 | if (m_data.m_slicePen.width() != pen.width()) |
|
616 | ||
546 | emit q_ptr->borderWidthChanged(); |
|
|||
547 | m_data.m_slicePen = pen; |
|
617 | m_data.m_slicePen = pen; | |
548 | m_data.m_slicePen.setThemed(themed); |
|
618 | m_data.m_slicePen.setThemed(themed); | |
|
619 | ||||
549 | emit q_ptr->penChanged(); |
|
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 | void QPieSlicePrivate::setBrush(const QBrush &brush, bool themed) |
|
628 | void QPieSlicePrivate::setBrush(const QBrush &brush, bool themed) | |
554 | { |
|
629 | { | |
555 | if (m_data.m_sliceBrush != brush) { |
|
630 | if (m_data.m_sliceBrush != brush) { | |
556 | if (m_data.m_sliceBrush.color() != brush.color()) |
|
631 | ||
557 | emit q_ptr->colorChanged(); |
|
632 | QBrush oldBrush = m_data.m_sliceBrush; | |
|
633 | ||||
558 | m_data.m_sliceBrush = brush; |
|
634 | m_data.m_sliceBrush = brush; | |
559 | m_data.m_sliceBrush.setThemed(themed); |
|
635 | m_data.m_sliceBrush.setThemed(themed); | |
|
636 | ||||
560 | emit q_ptr->brushChanged(); |
|
637 | emit q_ptr->brushChanged(); | |
|
638 | if (oldBrush.color() != brush.color()) | |||
|
639 | emit q_ptr->colorChanged(); | |||
561 | } |
|
640 | } | |
562 | } |
|
641 | } | |
563 |
|
642 | |||
564 | void QPieSlicePrivate::setLabelBrush(const QBrush &brush, bool themed) |
|
643 | void QPieSlicePrivate::setLabelBrush(const QBrush &brush, bool themed) | |
565 | { |
|
644 | { | |
566 | if (m_data.m_labelBrush != brush) { |
|
645 | if (m_data.m_labelBrush != brush) { | |
567 | if (m_data.m_labelBrush.color() != brush.color()) |
|
646 | ||
568 | emit q_ptr->labelColorChanged(); |
|
647 | QBrush oldBrush = m_data.m_labelBrush; | |
|
648 | ||||
569 | m_data.m_labelBrush = brush; |
|
649 | m_data.m_labelBrush = brush; | |
570 | m_data.m_labelBrush.setThemed(themed); |
|
650 | m_data.m_labelBrush.setThemed(themed); | |
|
651 | ||||
571 | emit q_ptr->labelBrushChanged(); |
|
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 | Q_PROPERTY(bool labelVisible READ isLabelVisible WRITE setLabelVisible NOTIFY labelVisibleChanged) |
|
39 | Q_PROPERTY(bool labelVisible READ isLabelVisible WRITE setLabelVisible NOTIFY labelVisibleChanged) | |
40 | Q_PROPERTY(bool exploded READ isExploded WRITE setExploded NOTIFY explodedChanged) |
|
40 | Q_PROPERTY(bool exploded READ isExploded WRITE setExploded NOTIFY explodedChanged) | |
41 | Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged) |
|
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 | Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged) |
|
44 | Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged) | |
|
45 | Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) | |||
43 | Q_PROPERTY(QBrush labelBrush READ labelBrush WRITE setLabelBrush NOTIFY labelBrushChanged) |
|
46 | Q_PROPERTY(QBrush labelBrush READ labelBrush WRITE setLabelBrush NOTIFY labelBrushChanged) | |
|
47 | Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor NOTIFY labelColorChanged) | |||
44 | Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont NOTIFY labelFontChanged) |
|
48 | Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont NOTIFY labelFontChanged) | |
45 | Q_PROPERTY(qreal labelArmLengthFactor READ labelArmLengthFactor WRITE setLabelArmLengthFactor) |
|
49 | Q_PROPERTY(qreal labelArmLengthFactor READ labelArmLengthFactor WRITE setLabelArmLengthFactor) | |
46 | Q_PROPERTY(qreal explodeDistanceFactor READ explodeDistanceFactor WRITE setExplodeDistanceFactor) |
|
50 | Q_PROPERTY(qreal explodeDistanceFactor READ explodeDistanceFactor WRITE setExplodeDistanceFactor) | |
47 | Q_PROPERTY(qreal percentage READ percentage NOTIFY percentageChanged) |
|
51 | Q_PROPERTY(qreal percentage READ percentage NOTIFY percentageChanged) | |
48 | Q_PROPERTY(qreal startAngle READ startAngle NOTIFY startAngleChanged) |
|
52 | Q_PROPERTY(qreal startAngle READ startAngle NOTIFY startAngleChanged) | |
49 | Q_PROPERTY(qreal angleSpan READ angleSpan NOTIFY angleSpanChanged) |
|
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 | public: |
|
55 | public: | |
56 | explicit QPieSlice(QObject *parent = 0); |
|
56 | explicit QPieSlice(QObject *parent = 0); | |
@@ -72,12 +72,24 public: | |||||
72 | void setPen(const QPen &pen); |
|
72 | void setPen(const QPen &pen); | |
73 | QPen pen() const; |
|
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 | void setBrush(const QBrush &brush); |
|
81 | void setBrush(const QBrush &brush); | |
76 | QBrush brush() const; |
|
82 | QBrush brush() const; | |
77 |
|
83 | |||
|
84 | QColor color(); | |||
|
85 | void setColor(QColor color); | |||
|
86 | ||||
78 | void setLabelBrush(const QBrush &brush); |
|
87 | void setLabelBrush(const QBrush &brush); | |
79 | QBrush labelBrush() const; |
|
88 | QBrush labelBrush() const; | |
80 |
|
89 | |||
|
90 | QColor labelColor(); | |||
|
91 | void setLabelColor(QColor color); | |||
|
92 | ||||
81 | void setLabelFont(const QFont &font); |
|
93 | void setLabelFont(const QFont &font); | |
82 | QFont labelFont() const; |
|
94 | QFont labelFont() const; | |
83 |
|
95 | |||
@@ -91,15 +103,6 public: | |||||
91 | qreal startAngle() const; |
|
103 | qreal startAngle() const; | |
92 | qreal angleSpan() const; |
|
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 | QPieSeries *series() const; |
|
106 | QPieSeries *series() const; | |
104 |
|
107 | |||
105 | Q_SIGNALS: |
|
108 | Q_SIGNALS: |
General Comments 0
You need to be logged in to leave comments.
Login now