summaryrefslogtreecommitdiffstats
path: root/src/charts/piechart/qpieslice.cpp
blob: 5a3f97db72e8556ff47c4375bb2c4619bb1d276e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd
** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://qt.io
**
** This file is part of the Qt Charts module.
**
** Licensees holding valid commercial license for Qt may use this file in
** accordance with the Qt License Agreement provided with the Software
** or, alternatively, in accordance with the terms contained in a written
** agreement between you and The Qt Company.
**
** If you have questions regarding the use of this file, please use
** contact form at http://qt.io
**
****************************************************************************/

#include <QtCharts/QPieSlice>
#include <private/qpieslice_p.h>

QT_CHARTS_BEGIN_NAMESPACE

/*!
    \class QPieSlice
    \inmodule Qt Charts
    \brief Defines a slice in pie series.

    This object defines the properties of a single slice in a QPieSeries.

    In addition to the obvious value and label properties the user can also control
    the visual appearance of a slice. By modifying the visual appearance also means that
    the user is overriding the default appearance set by the theme.

    Note that if the user has customized slices and theme is changed all customizations will be lost.

    To enable user interaction with the pie some basic signals are provided about clicking and hovering.
*/

/*!
    \qmltype PieSlice
    \instantiates QPieSlice
    \inqmlmodule QtCharts

    \brief Defines a slice in pie series.

    PieSlice defines the properties of a single slice in a PieSeries. The element should be used
    as a child for a PieSeries. For example:
    \snippet qmlpiechart/qml/qmlpiechart/main.qml 2

    An alternative (dynamic) method for adding slices to a PieSeries is using PieSeries.append
    method.
    \snippet qmlpiechart/qml/qmlpiechart/main.qml 4

    In that case you may want to use PieSeries.at or PieSeries.find to access the properties of
    an individual PieSlice instance.
    \snippet qmlpiechart/qml/qmlpiechart/main.qml 5
    \sa PieSeries
*/

/*!
 \enum QPieSlice::LabelPosition

 This enum describes the position of the slice label.

 \value LabelOutside Label is outside the slice with an arm.
 \value LabelInsideHorizontal Label is centered inside the slice and laid out horizontally.
 \value LabelInsideTangential Label is centered inside the slice and rotated to be parallel to the tangential of the slice's arc.
 \value LabelInsideNormal Label is centered inside the slice rotated to be parallel to the normal of the slice's arc.
 */

/*!
    \property QPieSlice::label
    Label of the slice.
    \sa labelVisible, labelBrush, labelFont, labelArmLengthFactor
*/
/*!
    \qmlproperty string PieSlice::label
    Label (text) of the slice.
*/

/*!
    \fn void QPieSlice::labelChanged()
    This signal emitted when the slice label has been changed.
    \sa label
*/
/*!
    \qmlsignal PieSlice::onLabelChanged()
    This signal emitted when the slice label has been changed.
    \sa label
*/

/*!
    \property QPieSlice::value
    Value of the slice.
    Note that if users sets a negative value it is converted to a positive value.
    \sa percentage(), QPieSeries::sum()
*/
/*!
    \qmlproperty real PieSlice::value
    Value of the slice. Note that if users sets a negative value it is converted to a positive value.
*/

/*!
    \fn void QPieSlice::valueChanged()
    This signal is emitted when the slice value changes.
    \sa value
*/
/*!
    \qmlsignal PieSlice::onValueChanged()
    This signal is emitted when the slice value changes.
    \sa value
*/

/*!
    \property QPieSlice::labelVisible
    Defines the visibility of slice label. By default the label is not visible.
    \sa label, labelBrush, labelFont, labelArmLengthFactor
*/
/*!
    \qmlproperty bool PieSlice::labelVisible
    Defines the visibility of slice label. By default the label is not visible.
*/

/*!
    \fn void QPieSlice::labelVisibleChanged()
    This signal emitted when visibility of the slice label has changed.
    \sa labelVisible
*/
/*!
    \qmlsignal PieSlice::onLabelVisibleChanged()
    This signal emitted when visibility of the slice label has changed.
    \sa labelVisible
*/

/*!
    \property QPieSlice::exploded
    If set to true the slice is "exploded" away from the pie.
    \sa explodeDistanceFactor
*/
/*!
    \qmlproperty bool PieSlice::exploded
    If set to true the slice is "exploded" away from the pie.
    \sa explodeDistanceFactor
*/

/*!
    \property QPieSlice::pen
    Pen used to draw the slice border.
*/

/*!
    \fn void QPieSlice::penChanged()
    This signal is emitted when the pen of the slice has changed.
    \sa pen
*/

/*!
    \property QPieSlice::borderColor
    Color used to draw the slice border.
    This is a convenience property for modifying the slice pen.
    \sa pen, borderWidth
*/
/*!
    \qmlproperty color PieSlice::borderColor
    Color used to draw the slice border (pen color).
    \sa borderWidth
*/

/*!
    \fn void QPieSlice::borderColorChanged()
    This signal is emitted when slice border color changes.
    \sa pen, borderColor
*/
/*!
    \qmlsignal PieSlice::onBorderColorChanged()
    This signal is emitted when slice border color changes.
    \sa borderColor
*/

/*!
    \property QPieSlice::borderWidth
    Width of the slice border.
    This is a convenience property for modifying the slice pen.
    \sa pen, borderColor
*/
/*!
    \qmlproperty int PieSlice::borderWidth
    Width of the slice border.
    This is a convenience property for modifying the slice pen.
    \sa borderColor
*/

/*!
    \fn void QPieSlice::borderWidthChanged()
    This signal is emitted when slice border width changes.
    \sa pen, borderWidth
*/
/*!
    \qmlsignal PieSlice::onBorderWidthChanged()
    This signal is emitted when slice border width changes.
    \sa borderWidth
*/

/*!
    \property QPieSlice::brush
    Brush used to draw the slice.
*/

/*!
    \fn void QPieSlice::brushChanged()
    This signal is emitted when the brush of the slice has changed.
    \sa brush
*/

/*!
    \qmlproperty QString PieSlice::brushFilename
    The name of the file used as a brush for the slice.
*/

/*!
    \property QPieSlice::color
    Fill (brush) color of the slice.
    This is a convenience property for modifying the slice brush.
    \sa brush
*/
/*!
    \qmlproperty color PieSlice::color
    Fill (brush) color of the slice.
*/

/*!
    \fn void QPieSlice::colorChanged()
    This signal is emitted when slice color changes.
    \sa brush
*/
/*!
    \qmlsignal PieSlice::onColorChanged()
    This signal is emitted when slice color changes.
*/

/*!
    \property QPieSlice::labelBrush
    Brush used to draw label and label arm of the slice.
    \sa label, labelVisible, labelFont, labelArmLengthFactor
*/

/*!
    \fn void QPieSlice::labelBrushChanged()
    This signal is emitted when the label brush of the slice has changed.
    \sa labelBrush
*/

/*!
    \property QPieSlice::labelColor
    Color used to draw the slice label.
    This is a convenience property for modifying the slice label brush.
    \sa labelBrush
*/
/*!
    \qmlproperty color PieSlice::labelColor
    Color used to draw the slice label.
*/

/*!
    \fn void QPieSlice::labelColorChanged()
    This signal is emitted when slice label color changes.
    \sa labelColor
*/
/*!
    \qmlsignal PieSlice::onLabelColorChanged()
    This signal is emitted when slice label color changes.
    \sa labelColor
*/

/*!
    \property QPieSlice::labelFont
    Font used for drawing label text.
    \sa label, labelVisible, labelArmLengthFactor
*/

/*!
    \fn void QPieSlice::labelFontChanged()
    This signal is emitted when the label font of the slice has changed.
    \sa labelFont
*/

/*!
    \qmlproperty Font PieSlice::labelFont

    Defines the font used for slice label.

    See the Qt documentation for more details of Font.

    \sa labelVisible, labelPosition
*/

/*!
    \property QPieSlice::labelPosition
    Position of the slice label.
    \sa label, labelVisible
*/
/*!
    \qmlproperty LabelPosition PieSlice::labelPosition
    Position of the slice label. One of PieSlice.LabelOutside, PieSlice.LabelInsideHorizontal,
    PieSlice.LabelInsideTangential or PieSlice.LabelInsideNormal. By default the position is
    PieSlice.LabelOutside.
    \sa labelVisible
*/

/*!
    \property QPieSlice::labelArmLengthFactor
    Defines the length of the label arm.
    The factor is relative to pie radius. For example:
    1.0 means the length is the same as the radius.
    0.5 means the length is half of the radius.
    By default the arm length is 0.15
    \sa label, labelVisible, labelBrush, labelFont
*/
/*!
    \qmlproperty real PieSlice::labelArmLengthFactor
    Defines the length of the label arm.
    The factor is relative to pie radius. For example:
    1.0 means the length is the same as the radius.
    0.5 means the length is half of the radius.
    By default the arm length is 0.15
    \sa labelVisible
*/

/*!
    \property QPieSlice::explodeDistanceFactor
    When the slice is exploded this factor defines how far the slice is exploded away from the pie.
    The factor is relative to pie radius. For example:
    1.0 means the distance is the same as the radius.
    0.5 means the distance is half of the radius.
    By default the distance is is 0.15
    \sa exploded
*/
/*!
    \qmlproperty real PieSlice::explodeDistanceFactor
    When the slice is exploded this factor defines how far the slice is exploded away from the pie.
    The factor is relative to pie radius. For example:
    1.0 means the distance is the same as the radius.
    0.5 means the distance is half of the radius.
    By default the distance is is 0.15
    \sa exploded
*/

/*!
    \property QPieSlice::percentage
    Percentage of the slice compared to the sum of all slices in the series.
    The actual value ranges from 0.0 to 1.0.
    Updated automatically once the slice is added to the series.
    \sa value, QPieSeries::sum
*/
/*!
    \qmlproperty real PieSlice::percentage
    Percentage of the slice compared to the sum of all slices in the series.
    The actual value ranges from 0.0 to 1.0.
    Updated automatically once the slice is added to the series.
*/

/*!
    \fn void QPieSlice::percentageChanged()
    This signal is emitted when the percentage of the slice has changed.
    \sa percentage
*/
/*!
    \qmlsignal void PieSlice::onPercentageChanged()
    This signal is emitted when the percentage of the slice has changed.
    \sa percentage
*/

/*!
    \property QPieSlice::startAngle
    Defines the starting angle of this slice in the series it belongs to.
    Full pie is 360 degrees where 0 degrees is at 12 a'clock.
    Updated automatically once the slice is added to the series.
*/
/*!
    \qmlproperty real PieSlice::startAngle
    Defines the starting angle of this slice in the series it belongs to.
    Full pie is 360 degrees where 0 degrees is at 12 a'clock.
    Updated automatically once the slice is added to the series.
*/

/*!
    \fn void QPieSlice::startAngleChanged()
    This signal is emitted when the starting angle f the slice has changed.
    \sa startAngle
*/
/*!
    \qmlsignal PieSlice::onStartAngleChanged()
    This signal is emitted when the starting angle f the slice has changed.
    \sa startAngle
*/

/*!
    \property QPieSlice::angleSpan
    Span of the slice in degrees.
    Full pie is 360 degrees where 0 degrees is at 12 a'clock.
    Updated automatically once the slice is added to the series.
*/
/*!
    \qmlproperty real PieSlice::angleSpan
    Span of the slice in degrees.
    Full pie is 360 degrees where 0 degrees is at 12 a'clock.
    Updated automatically once the slice is added to the series.
*/

/*!
    \fn void QPieSlice::angleSpanChanged()
    This signal is emitted when the angle span of the slice has changed.
    \sa angleSpan
*/
/*!
    \qmlsignal PieSlice::onAngleSpanChanged()
    This signal is emitted when the angle span of the slice has changed.
    \sa angleSpan
*/

/*!
    \fn void QPieSlice::clicked()
    This signal is emitted when user has clicked the slice.
    \sa QPieSeries::clicked()
*/
/*!
    \qmlsignal PieSlice::onClicked()
    This signal is emitted when user has clicked the slice.
*/

/*!
    \fn void QPieSlice::pressed()
    This signal is emitted when user has pressed the slice.
    \sa QPieSeries::pressed()
*/
/*!
    \qmlsignal PieSlice::onPressed()
    This signal is emitted when user has pressed the slice.
*/

/*!
    \fn void QPieSlice::released()
    This signal is emitted when user has released the slice.
    \sa QPieSeries::released()
*/
/*!
    \qmlsignal PieSlice::onReleased()
    This signal is emitted when user has released the slice.
*/

/*!
    \fn void QPieSlice::doubleClicked()
    This signal is emitted when user has doubleclicked the slice.
    \sa QPieSeries::doubleClicked()
*/
/*!
    \qmlsignal PieSlice::onDoubleClicked()
    This signal is emitted when user has doubleclicked the slice.
*/

/*!
    \fn void QPieSlice::hovered(bool state)
    This signal is emitted when user has hovered over or away from the slice.
    \a state is true when user has hovered over the slice and false when hover has moved away from the slice.
    \sa QPieSeries::hovered()
*/
/*!
    \qmlsignal PieSlice::onHovered(bool state)
    This signal is emitted when user has hovered over or away from the slice.
    \a state is true when user has hovered over the slice and false when hover has moved away from the slice.
*/

/*!
    Constructs an empty slice with a \a parent.
    \sa QPieSeries::append(), QPieSeries::insert()
*/
QPieSlice::QPieSlice(QObject *parent)
    : QObject(parent),
      d_ptr(new QPieSlicePrivate(this))
{

}

/*!
    Constructs an empty slice with given \a value, \a label and a \a parent.
    \sa QPieSeries::append(), QPieSeries::insert()
*/
QPieSlice::QPieSlice(QString label, qreal value, QObject *parent)
    : QObject(parent),
      d_ptr(new QPieSlicePrivate(this))
{
    setValue(value);
    setLabel(label);
}

/*!
    Destroys the slice.
    User should not delete the slice if it has been added to the series.
*/
QPieSlice::~QPieSlice()
{

}

void QPieSlice::setLabel(QString label)
{
    if (d_ptr->m_data.m_labelText != label) {
        d_ptr->m_data.m_labelText = label;
        emit labelChanged();
    }
}

QString QPieSlice::label() const
{
    return d_ptr->m_data.m_labelText;
}

void QPieSlice::setValue(qreal value)
{
    value = qAbs(value); // negative values not allowed
    if (!qFuzzyCompare(d_ptr->m_data.m_value, value)) {
        d_ptr->m_data.m_value = value;
        emit valueChanged();
    }
}

qreal QPieSlice::value() const
{
    return d_ptr->m_data.m_value;
}

void QPieSlice::setLabelVisible(bool visible)
{
    if (d_ptr->m_data.m_isLabelVisible != visible) {
        d_ptr->m_data.m_isLabelVisible = visible;
        emit labelVisibleChanged();
    }
}

bool QPieSlice::isLabelVisible() const
{
    return d_ptr->m_data.m_isLabelVisible;
}

void QPieSlice::setExploded(bool exploded)
{
    if (d_ptr->m_data.m_isExploded != exploded) {
        d_ptr->m_data.m_isExploded = exploded;
        emit d_ptr->explodedChanged();
    }
}

QPieSlice::LabelPosition QPieSlice::labelPosition()
{
    return d_ptr->m_data.m_labelPosition;
}

void QPieSlice::setLabelPosition(LabelPosition position)
{
    if (d_ptr->m_data.m_labelPosition != position) {
        d_ptr->m_data.m_labelPosition = position;
        emit d_ptr->labelPositionChanged();
    }
}

bool QPieSlice::isExploded() const
{
    return d_ptr->m_data.m_isExploded;
}

void QPieSlice::setPen(const QPen &pen)
{
    d_ptr->setPen(pen, false);
}

QPen QPieSlice::pen() const
{
    return d_ptr->m_data.m_slicePen;
}

QColor QPieSlice::borderColor()
{
    return pen().color();
}

void QPieSlice::setBorderColor(QColor color)
{
    QPen p = pen();
    if (color != p.color()) {
        p.setColor(color);
        setPen(p);
    }
}

int QPieSlice::borderWidth()
{
    return pen().width();
}

void QPieSlice::setBorderWidth(int width)
{
    QPen p = pen();
    if (width != p.width()) {
        p.setWidth(width);
        setPen(p);
    }
}

void QPieSlice::setBrush(const QBrush &brush)
{
    d_ptr->setBrush(brush, false);
}

QBrush QPieSlice::brush() const
{
    return d_ptr->m_data.m_sliceBrush;
}

QColor QPieSlice::color()
{
    return brush().color();
}

void QPieSlice::setColor(QColor color)
{
    QBrush b = brush();

    if (b == QBrush())
        b.setStyle(Qt::SolidPattern);
    b.setColor(color);
    setBrush(b);
}

void QPieSlice::setLabelBrush(const QBrush &brush)
{
    d_ptr->setLabelBrush(brush, false);
}

QBrush QPieSlice::labelBrush() const
{
    return d_ptr->m_data.m_labelBrush;
}

QColor QPieSlice::labelColor()
{
    return labelBrush().color();
}

void QPieSlice::setLabelColor(QColor color)
{
    QBrush b = labelBrush();
    if (color != b.color()) {
        b.setColor(color);
        setLabelBrush(b);
    }
}

void QPieSlice::setLabelFont(const QFont &font)
{
    d_ptr->setLabelFont(font, false);
}

QFont QPieSlice::labelFont() const
{
    return d_ptr->m_data.m_labelFont;
}

void QPieSlice::setLabelArmLengthFactor(qreal factor)
{
    if (!qFuzzyCompare(d_ptr->m_data.m_labelArmLengthFactor, factor)) {
        d_ptr->m_data.m_labelArmLengthFactor = factor;
        emit d_ptr->labelArmLengthFactorChanged();
    }
}

qreal QPieSlice::labelArmLengthFactor() const
{
    return d_ptr->m_data.m_labelArmLengthFactor;
}

void QPieSlice::setExplodeDistanceFactor(qreal factor)
{
    if (!qFuzzyCompare(d_ptr->m_data.m_explodeDistanceFactor, factor)) {
        d_ptr->m_data.m_explodeDistanceFactor = factor;
        emit d_ptr->explodeDistanceFactorChanged();
    }
}

qreal QPieSlice::explodeDistanceFactor() const
{
    return d_ptr->m_data.m_explodeDistanceFactor;
}

qreal QPieSlice::percentage() const
{
    return d_ptr->m_data.m_percentage;
}

qreal QPieSlice::startAngle() const
{
    return d_ptr->m_data.m_startAngle;
}

qreal QPieSlice::angleSpan() const
{
    return d_ptr->m_data.m_angleSpan;
}

/*!
  Returns the series that this slice belongs to.

  \sa QPieSeries::append()
*/
QPieSeries *QPieSlice::series() const
{
    return d_ptr->m_series;
}

QPieSlicePrivate::QPieSlicePrivate(QPieSlice *parent)
    : QObject(parent),
      q_ptr(parent),
      m_series(0)
{

}

QPieSlicePrivate::~QPieSlicePrivate()
{

}

QPieSlicePrivate *QPieSlicePrivate::fromSlice(QPieSlice *slice)
{
    return slice->d_func();
}

void QPieSlicePrivate::setPen(const QPen &pen, bool themed)
{
    if (m_data.m_slicePen != pen) {

        QPen oldPen = m_data.m_slicePen;

        m_data.m_slicePen = pen;
        m_data.m_slicePen.setThemed(themed);

        emit q_ptr->penChanged();
        if (oldPen.color() != pen.color())
            emit q_ptr->borderColorChanged();
        if (oldPen.width() != pen.width())
            emit q_ptr->borderWidthChanged();
    }
}

void QPieSlicePrivate::setBrush(const QBrush &brush, bool themed)
{
    if (m_data.m_sliceBrush != brush) {

        QBrush oldBrush = m_data.m_sliceBrush;

        m_data.m_sliceBrush = brush;
        m_data.m_sliceBrush.setThemed(themed);

        emit q_ptr->brushChanged();
        if (oldBrush.color() != brush.color())
            emit q_ptr->colorChanged();
    }
}

void QPieSlicePrivate::setLabelBrush(const QBrush &brush, bool themed)
{
    if (m_data.m_labelBrush != brush) {

        QBrush oldBrush = m_data.m_labelBrush;

        m_data.m_labelBrush = brush;
        m_data.m_labelBrush.setThemed(themed);

        emit q_ptr->labelBrushChanged();
        if (oldBrush.color() != brush.color())
            emit q_ptr->labelColorChanged();
    }
}

void QPieSlicePrivate::setLabelFont(const QFont &font, bool themed)
{
    if (m_data.m_labelFont != font) {
        m_data.m_labelFont = font;
        m_data.m_labelFont.setThemed(themed);
        emit q_ptr->labelFontChanged();
    }
}

void QPieSlicePrivate::setPercentage(qreal percentage)
{
    if (!qFuzzyCompare(m_data.m_percentage, percentage)) {
        m_data.m_percentage = percentage;
        emit q_ptr->percentageChanged();
    }
}

void QPieSlicePrivate::setStartAngle(qreal angle)
{
    if (!qFuzzyCompare(m_data.m_startAngle, angle)) {
        m_data.m_startAngle = angle;
        emit q_ptr->startAngleChanged();
    }
}

void QPieSlicePrivate::setAngleSpan(qreal span)
{
    if (!qFuzzyCompare(m_data.m_angleSpan, span)) {
        m_data.m_angleSpan = span;
        emit q_ptr->angleSpanChanged();
    }
}

QT_CHARTS_END_NAMESPACE

QT_CHARTS_USE_NAMESPACE
#include "moc_qpieslice.cpp"
#include "moc_qpieslice_p.cpp"