@@ -38,13 +38,14 PieChartItem::PieChartItem(QPieSeries *series, ChartPresenter* presenter) | |||
|
38 | 38 | { |
|
39 | 39 | Q_ASSERT(series); |
|
40 | 40 | |
|
41 | QPieSeriesPrivate *p = QPieSeriesPrivate::fromSeries(series); | |
|
41 | 42 | connect(series, SIGNAL(visibleChanged()), this, SLOT(handleSeriesVisibleChanged())); |
|
42 | 43 | connect(series, SIGNAL(added(QList<QPieSlice*>)), this, SLOT(handleSlicesAdded(QList<QPieSlice*>))); |
|
43 | 44 | connect(series, SIGNAL(removed(QList<QPieSlice*>)), this, SLOT(handleSlicesRemoved(QList<QPieSlice*>))); |
|
44 |
connect( |
|
|
45 |
connect( |
|
|
46 |
connect( |
|
|
47 |
connect( |
|
|
45 | connect(p, SIGNAL(horizontalPositionChanged()), this, SLOT(updateLayout())); | |
|
46 | connect(p, SIGNAL(verticalPositionChanged()), this, SLOT(updateLayout())); | |
|
47 | connect(p, SIGNAL(pieSizeChanged()), this, SLOT(updateLayout())); | |
|
48 | connect(p, SIGNAL(calculatedDataChanged()), this, SLOT(updateLayout())); | |
|
48 | 49 | |
|
49 | 50 | // Note: the following does not affect as long as the item does not have anything to paint |
|
50 | 51 | setZValue(ChartPresenter::PieSeriesZValue); |
@@ -66,14 +66,6 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
66 | 66 | */ |
|
67 | 67 | |
|
68 | 68 | /*! |
|
69 | \fn void QPieSeries::horizontalPositionChanged() | |
|
70 | ||
|
71 | Emitted then the horizontal position of the pie has changed. | |
|
72 | ||
|
73 | \sa horizontalPosition | |
|
74 | */ | |
|
75 | ||
|
76 | /*! | |
|
77 | 69 | \property QPieSeries::verticalPosition |
|
78 | 70 | \brief Defines the vertical position of the pie. |
|
79 | 71 | |
@@ -90,14 +82,6 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
90 | 82 | */ |
|
91 | 83 | |
|
92 | 84 | /*! |
|
93 | \fn void QPieSeries::verticalPositionChanged() | |
|
94 | ||
|
95 | Emitted then the vertical position of the pie has changed. | |
|
96 | ||
|
97 | \sa verticalPosition | |
|
98 | */ | |
|
99 | ||
|
100 | /*! | |
|
101 | 85 | \property QPieSeries::size |
|
102 | 86 | \brief Defines the pie size. |
|
103 | 87 | |
@@ -112,14 +96,6 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
112 | 96 | */ |
|
113 | 97 | |
|
114 | 98 | /*! |
|
115 | \fn void QPieSeries::pieSizeChanged() | |
|
116 | ||
|
117 | Emitted when the pie size has changed. | |
|
118 | ||
|
119 | \sa size | |
|
120 | */ | |
|
121 | ||
|
122 | /*! | |
|
123 | 99 | \property QPieSeries::startAngle |
|
124 | 100 | \brief Defines the starting angle of the pie. |
|
125 | 101 | |
@@ -129,14 +105,6 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
129 | 105 | */ |
|
130 | 106 | |
|
131 | 107 | /*! |
|
132 | \fn void QPieSeries::pieStartAngleChanged() | |
|
133 | ||
|
134 | Emitted when the starting angle of the pie has changed. | |
|
135 | ||
|
136 | \sa startAngle | |
|
137 | */ | |
|
138 | ||
|
139 | /*! | |
|
140 | 108 | \property QPieSeries::endAngle |
|
141 | 109 | \brief Defines the ending angle of the pie. |
|
142 | 110 | |
@@ -146,14 +114,6 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
146 | 114 | */ |
|
147 | 115 | |
|
148 | 116 | /*! |
|
149 | \fn void QPieSeries::pieEndAngleChanged() | |
|
150 | ||
|
151 | Emitted when the ending angle of the pie has changed. | |
|
152 | ||
|
153 | \sa endAngle | |
|
154 | */ | |
|
155 | ||
|
156 | /*! | |
|
157 | 117 | \property QPieSeries::count |
|
158 | 118 | |
|
159 | 119 | Number of slices in the series. |
@@ -445,7 +405,7 void QPieSeries::setHorizontalPosition(qreal relativePosition) | |||
|
445 | 405 | |
|
446 | 406 | if (!qFuzzyIsNull(d->m_pieRelativeHorPos - relativePosition)) { |
|
447 | 407 | d->m_pieRelativeHorPos = relativePosition; |
|
448 | emit horizontalPositionChanged(); | |
|
408 | emit d->horizontalPositionChanged(); | |
|
449 | 409 | } |
|
450 | 410 | } |
|
451 | 411 | |
@@ -466,7 +426,7 void QPieSeries::setVerticalPosition(qreal relativePosition) | |||
|
466 | 426 | |
|
467 | 427 | if (!qFuzzyIsNull(d->m_pieRelativeVerPos - relativePosition)) { |
|
468 | 428 | d->m_pieRelativeVerPos = relativePosition; |
|
469 | emit verticalPositionChanged(); | |
|
429 | emit d->verticalPositionChanged(); | |
|
470 | 430 | } |
|
471 | 431 | } |
|
472 | 432 | |
@@ -487,7 +447,7 void QPieSeries::setPieSize(qreal relativeSize) | |||
|
487 | 447 | |
|
488 | 448 | if (!qFuzzyIsNull(d->m_pieRelativeSize - relativeSize)) { |
|
489 | 449 | d->m_pieRelativeSize = relativeSize; |
|
490 | emit pieSizeChanged(); | |
|
450 | emit d->pieSizeChanged(); | |
|
491 | 451 | } |
|
492 | 452 | } |
|
493 | 453 | |
@@ -505,7 +465,7 void QPieSeries::setPieStartAngle(qreal angle) | |||
|
505 | 465 | return; |
|
506 | 466 | d->m_pieStartAngle = angle; |
|
507 | 467 | d->updateDerivativeData(); |
|
508 | emit pieStartAngleChanged(); | |
|
468 | emit d->pieStartAngleChanged(); | |
|
509 | 469 | } |
|
510 | 470 | |
|
511 | 471 | qreal QPieSeries::pieStartAngle() const |
@@ -530,7 +490,7 void QPieSeries::setPieEndAngle(qreal angle) | |||
|
530 | 490 | return; |
|
531 | 491 | d->m_pieEndAngle = angle; |
|
532 | 492 | d->updateDerivativeData(); |
|
533 | emit pieEndAngleChanged(); | |
|
493 | emit d->pieEndAngleChanged(); | |
|
534 | 494 | } |
|
535 | 495 | |
|
536 | 496 | /*! |
@@ -30,11 +30,11 class QPieSlice; | |||
|
30 | 30 | class QTCOMMERCIALCHART_EXPORT QPieSeries : public QAbstractSeries |
|
31 | 31 | { |
|
32 | 32 | Q_OBJECT |
|
33 |
Q_PROPERTY(qreal horizontalPosition READ horizontalPosition WRITE setHorizontalPosition |
|
|
34 |
Q_PROPERTY(qreal verticalPosition READ verticalPosition WRITE setVerticalPosition |
|
|
35 |
Q_PROPERTY(qreal size READ pieSize WRITE setPieSize |
|
|
36 |
Q_PROPERTY(qreal startAngle READ pieStartAngle WRITE setPieStartAngle |
|
|
37 |
Q_PROPERTY(qreal endAngle READ pieEndAngle WRITE setPieEndAngle |
|
|
33 | Q_PROPERTY(qreal horizontalPosition READ horizontalPosition WRITE setHorizontalPosition) | |
|
34 | Q_PROPERTY(qreal verticalPosition READ verticalPosition WRITE setVerticalPosition) | |
|
35 | Q_PROPERTY(qreal size READ pieSize WRITE setPieSize) | |
|
36 | Q_PROPERTY(qreal startAngle READ pieStartAngle WRITE setPieStartAngle) | |
|
37 | Q_PROPERTY(qreal endAngle READ pieEndAngle WRITE setPieEndAngle) | |
|
38 | 38 | Q_PROPERTY(int count READ count NOTIFY countChanged) |
|
39 | 39 | Q_PROPERTY(qreal sum READ sum NOTIFY sumChanged) |
|
40 | 40 | |
@@ -85,11 +85,6 Q_SIGNALS: | |||
|
85 | 85 | void hovered(QPieSlice* slice, bool state); |
|
86 | 86 | void countChanged(); |
|
87 | 87 | void sumChanged(); |
|
88 | void pieSizeChanged(); | |
|
89 | void pieStartAngleChanged(); | |
|
90 | void pieEndAngleChanged(); | |
|
91 | void horizontalPositionChanged(); | |
|
92 | void verticalPositionChanged(); | |
|
93 | 88 | |
|
94 | 89 | private: |
|
95 | 90 | Q_DECLARE_PRIVATE(QPieSeries) |
@@ -54,6 +54,11 public: | |||
|
54 | 54 | |
|
55 | 55 | signals: |
|
56 | 56 | void calculatedDataChanged(); |
|
57 | void pieSizeChanged(); | |
|
58 | void pieStartAngleChanged(); | |
|
59 | void pieEndAngleChanged(); | |
|
60 | void horizontalPositionChanged(); | |
|
61 | void verticalPositionChanged(); | |
|
57 | 62 | |
|
58 | 63 | public Q_SLOTS: |
|
59 | 64 | void sliceValueChanged(); |
@@ -90,11 +90,6 void tst_qpieseries::properties() | |||
|
90 | 90 | { |
|
91 | 91 | QSignalSpy countSpy(m_series, SIGNAL(countChanged())); |
|
92 | 92 | QSignalSpy sumSpy(m_series, SIGNAL(sumChanged())); |
|
93 | QSignalSpy sizeSpy(m_series, SIGNAL(pieSizeChanged())); | |
|
94 | QSignalSpy startAngleSpy(m_series, SIGNAL(pieStartAngleChanged())); | |
|
95 | QSignalSpy endAngleSpy(m_series, SIGNAL(pieEndAngleChanged())); | |
|
96 | QSignalSpy horPosSpy(m_series, SIGNAL(horizontalPositionChanged())); | |
|
97 | QSignalSpy verPosSpy(m_series, SIGNAL(verticalPositionChanged())); | |
|
98 | 93 | |
|
99 | 94 | QVERIFY(m_series->type() == QAbstractSeries::SeriesTypePie); |
|
100 | 95 | QVERIFY(m_series->count() == 0); |
@@ -125,17 +120,16 void tst_qpieseries::properties() | |||
|
125 | 120 | m_series->setPieSize(0.9); |
|
126 | 121 | m_series->setPieSize(2.0); |
|
127 | 122 | QCOMPARE(m_series->pieSize(), 1.0); |
|
128 | QCOMPARE(sizeSpy.count(), 3); | |
|
129 | 123 | |
|
130 | 124 | m_series->setPieStartAngle(0); |
|
131 | 125 | m_series->setPieStartAngle(-180); |
|
132 | 126 | m_series->setPieStartAngle(180); |
|
133 |
QCOMPARE(startAngle |
|
|
127 | QCOMPARE(m_series->pieStartAngle(), 180.0); | |
|
134 | 128 | |
|
135 | 129 | m_series->setPieEndAngle(360); |
|
136 | 130 | m_series->setPieEndAngle(-180); |
|
137 | 131 | m_series->setPieEndAngle(180); |
|
138 |
QCOMPARE(endAngle |
|
|
132 | QCOMPARE(m_series->pieEndAngle(), 180.0); | |
|
139 | 133 | |
|
140 | 134 | m_series->setHorizontalPosition(0.5); |
|
141 | 135 | m_series->setHorizontalPosition(-1.0); |
@@ -143,7 +137,6 void tst_qpieseries::properties() | |||
|
143 | 137 | m_series->setHorizontalPosition(1.0); |
|
144 | 138 | m_series->setHorizontalPosition(2.0); |
|
145 | 139 | QCOMPARE(m_series->horizontalPosition(), 1.0); |
|
146 | QCOMPARE(horPosSpy.count(), 2); | |
|
147 | 140 | |
|
148 | 141 | m_series->setVerticalPosition(0.5); |
|
149 | 142 | m_series->setVerticalPosition(-1.0); |
@@ -151,7 +144,6 void tst_qpieseries::properties() | |||
|
151 | 144 | m_series->setVerticalPosition(1.0); |
|
152 | 145 | m_series->setVerticalPosition(2.0); |
|
153 | 146 | QCOMPARE(m_series->verticalPosition(), 1.0); |
|
154 | QCOMPARE(verPosSpy.count(), 2); | |
|
155 | 147 | } |
|
156 | 148 | |
|
157 | 149 | void tst_qpieseries::append() |
@@ -41,11 +41,6 Flow { | |||
|
41 | 41 | id: seriesConnections |
|
42 | 42 | target: null |
|
43 | 43 | onVisibleChanged: console.log("series.onVisibleChanged: " + series.visible); |
|
44 | onHorizontalPositionChanged:console.log("series.onHorizontalPositionChanged: " + series.horizontalPosition); | |
|
45 | onVerticalPositionChanged: console.log("series.onVerticalPositionChanged: " + series.verticalPosition); | |
|
46 | onSizeChanged: console.log("series.onSizeChanged: " + series.size); | |
|
47 | onStartAngleChanged: console.log("series.onStartAngleChanged: " + series.startAngle); | |
|
48 | onEndAngleChanged: console.log("series.onEndAngleChanged: " + series.endAngle); | |
|
49 | 44 | onCountChanged: console.log("series.onCountChanged: " + series.count); |
|
50 | 45 | onSumChanged: console.log("series.onSumChanged: " + series.sum); |
|
51 | 46 | } |
General Comments 0
You need to be logged in to leave comments.
Login now