From 57681a863659f13d6073ef7cde9a15e9a50e6ece 2012-06-18 11:42:51 From: Tero Ahola Date: 2012-06-18 11:42:51 Subject: [PATCH] Removed a few signals from QPieSeries API --- diff --git a/src/piechart/piechartitem.cpp b/src/piechart/piechartitem.cpp index 6e47710..6bb58ce 100644 --- a/src/piechart/piechartitem.cpp +++ b/src/piechart/piechartitem.cpp @@ -38,13 +38,14 @@ PieChartItem::PieChartItem(QPieSeries *series, ChartPresenter* presenter) { Q_ASSERT(series); + QPieSeriesPrivate *p = QPieSeriesPrivate::fromSeries(series); connect(series, SIGNAL(visibleChanged()), this, SLOT(handleSeriesVisibleChanged())); connect(series, SIGNAL(added(QList)), this, SLOT(handleSlicesAdded(QList))); connect(series, SIGNAL(removed(QList)), this, SLOT(handleSlicesRemoved(QList))); - connect(series, SIGNAL(horizontalPositionChanged()), this, SLOT(updateLayout())); - connect(series, SIGNAL(verticalPositionChanged()), this, SLOT(updateLayout())); - connect(series, SIGNAL(pieSizeChanged()), this, SLOT(updateLayout())); - connect(QPieSeriesPrivate::fromSeries(series), SIGNAL(calculatedDataChanged()), this, SLOT(updateLayout())); + connect(p, SIGNAL(horizontalPositionChanged()), this, SLOT(updateLayout())); + connect(p, SIGNAL(verticalPositionChanged()), this, SLOT(updateLayout())); + connect(p, SIGNAL(pieSizeChanged()), this, SLOT(updateLayout())); + connect(p, SIGNAL(calculatedDataChanged()), this, SLOT(updateLayout())); // Note: the following does not affect as long as the item does not have anything to paint setZValue(ChartPresenter::PieSeriesZValue); diff --git a/src/piechart/qpieseries.cpp b/src/piechart/qpieseries.cpp index 9f7dd96..218c19f 100644 --- a/src/piechart/qpieseries.cpp +++ b/src/piechart/qpieseries.cpp @@ -66,14 +66,6 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! - \fn void QPieSeries::horizontalPositionChanged() - - Emitted then the horizontal position of the pie has changed. - - \sa horizontalPosition -*/ - -/*! \property QPieSeries::verticalPosition \brief Defines the vertical position of the pie. @@ -90,14 +82,6 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! - \fn void QPieSeries::verticalPositionChanged() - - Emitted then the vertical position of the pie has changed. - - \sa verticalPosition -*/ - -/*! \property QPieSeries::size \brief Defines the pie size. @@ -112,14 +96,6 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! - \fn void QPieSeries::pieSizeChanged() - - Emitted when the pie size has changed. - - \sa size -*/ - -/*! \property QPieSeries::startAngle \brief Defines the starting angle of the pie. @@ -129,14 +105,6 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! - \fn void QPieSeries::pieStartAngleChanged() - - Emitted when the starting angle of the pie has changed. - - \sa startAngle -*/ - -/*! \property QPieSeries::endAngle \brief Defines the ending angle of the pie. @@ -146,14 +114,6 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! - \fn void QPieSeries::pieEndAngleChanged() - - Emitted when the ending angle of the pie has changed. - - \sa endAngle -*/ - -/*! \property QPieSeries::count Number of slices in the series. @@ -445,7 +405,7 @@ void QPieSeries::setHorizontalPosition(qreal relativePosition) if (!qFuzzyIsNull(d->m_pieRelativeHorPos - relativePosition)) { d->m_pieRelativeHorPos = relativePosition; - emit horizontalPositionChanged(); + emit d->horizontalPositionChanged(); } } @@ -466,7 +426,7 @@ void QPieSeries::setVerticalPosition(qreal relativePosition) if (!qFuzzyIsNull(d->m_pieRelativeVerPos - relativePosition)) { d->m_pieRelativeVerPos = relativePosition; - emit verticalPositionChanged(); + emit d->verticalPositionChanged(); } } @@ -487,7 +447,7 @@ void QPieSeries::setPieSize(qreal relativeSize) if (!qFuzzyIsNull(d->m_pieRelativeSize - relativeSize)) { d->m_pieRelativeSize = relativeSize; - emit pieSizeChanged(); + emit d->pieSizeChanged(); } } @@ -505,7 +465,7 @@ void QPieSeries::setPieStartAngle(qreal angle) return; d->m_pieStartAngle = angle; d->updateDerivativeData(); - emit pieStartAngleChanged(); + emit d->pieStartAngleChanged(); } qreal QPieSeries::pieStartAngle() const @@ -530,7 +490,7 @@ void QPieSeries::setPieEndAngle(qreal angle) return; d->m_pieEndAngle = angle; d->updateDerivativeData(); - emit pieEndAngleChanged(); + emit d->pieEndAngleChanged(); } /*! diff --git a/src/piechart/qpieseries.h b/src/piechart/qpieseries.h index 21ea607..abedbc7 100644 --- a/src/piechart/qpieseries.h +++ b/src/piechart/qpieseries.h @@ -30,11 +30,11 @@ class QPieSlice; class QTCOMMERCIALCHART_EXPORT QPieSeries : public QAbstractSeries { Q_OBJECT - Q_PROPERTY(qreal horizontalPosition READ horizontalPosition WRITE setHorizontalPosition NOTIFY horizontalPositionChanged) - Q_PROPERTY(qreal verticalPosition READ verticalPosition WRITE setVerticalPosition NOTIFY verticalPositionChanged) - Q_PROPERTY(qreal size READ pieSize WRITE setPieSize NOTIFY pieSizeChanged) - Q_PROPERTY(qreal startAngle READ pieStartAngle WRITE setPieStartAngle NOTIFY pieStartAngleChanged) - Q_PROPERTY(qreal endAngle READ pieEndAngle WRITE setPieEndAngle NOTIFY pieEndAngleChanged) + Q_PROPERTY(qreal horizontalPosition READ horizontalPosition WRITE setHorizontalPosition) + Q_PROPERTY(qreal verticalPosition READ verticalPosition WRITE setVerticalPosition) + Q_PROPERTY(qreal size READ pieSize WRITE setPieSize) + Q_PROPERTY(qreal startAngle READ pieStartAngle WRITE setPieStartAngle) + Q_PROPERTY(qreal endAngle READ pieEndAngle WRITE setPieEndAngle) Q_PROPERTY(int count READ count NOTIFY countChanged) Q_PROPERTY(qreal sum READ sum NOTIFY sumChanged) @@ -85,11 +85,6 @@ Q_SIGNALS: void hovered(QPieSlice* slice, bool state); void countChanged(); void sumChanged(); - void pieSizeChanged(); - void pieStartAngleChanged(); - void pieEndAngleChanged(); - void horizontalPositionChanged(); - void verticalPositionChanged(); private: Q_DECLARE_PRIVATE(QPieSeries) diff --git a/src/piechart/qpieseries_p.h b/src/piechart/qpieseries_p.h index 5fcf6db..42d1431 100644 --- a/src/piechart/qpieseries_p.h +++ b/src/piechart/qpieseries_p.h @@ -54,6 +54,11 @@ public: signals: void calculatedDataChanged(); + void pieSizeChanged(); + void pieStartAngleChanged(); + void pieEndAngleChanged(); + void horizontalPositionChanged(); + void verticalPositionChanged(); public Q_SLOTS: void sliceValueChanged(); diff --git a/tests/auto/qpieseries/tst_qpieseries.cpp b/tests/auto/qpieseries/tst_qpieseries.cpp index 8fa8f14..49c4a30 100644 --- a/tests/auto/qpieseries/tst_qpieseries.cpp +++ b/tests/auto/qpieseries/tst_qpieseries.cpp @@ -90,11 +90,6 @@ void tst_qpieseries::properties() { QSignalSpy countSpy(m_series, SIGNAL(countChanged())); QSignalSpy sumSpy(m_series, SIGNAL(sumChanged())); - QSignalSpy sizeSpy(m_series, SIGNAL(pieSizeChanged())); - QSignalSpy startAngleSpy(m_series, SIGNAL(pieStartAngleChanged())); - QSignalSpy endAngleSpy(m_series, SIGNAL(pieEndAngleChanged())); - QSignalSpy horPosSpy(m_series, SIGNAL(horizontalPositionChanged())); - QSignalSpy verPosSpy(m_series, SIGNAL(verticalPositionChanged())); QVERIFY(m_series->type() == QAbstractSeries::SeriesTypePie); QVERIFY(m_series->count() == 0); @@ -125,17 +120,16 @@ void tst_qpieseries::properties() m_series->setPieSize(0.9); m_series->setPieSize(2.0); QCOMPARE(m_series->pieSize(), 1.0); - QCOMPARE(sizeSpy.count(), 3); m_series->setPieStartAngle(0); m_series->setPieStartAngle(-180); m_series->setPieStartAngle(180); - QCOMPARE(startAngleSpy.count(), 2); + QCOMPARE(m_series->pieStartAngle(), 180.0); m_series->setPieEndAngle(360); m_series->setPieEndAngle(-180); m_series->setPieEndAngle(180); - QCOMPARE(endAngleSpy.count(), 2); + QCOMPARE(m_series->pieEndAngle(), 180.0); m_series->setHorizontalPosition(0.5); m_series->setHorizontalPosition(-1.0); @@ -143,7 +137,6 @@ void tst_qpieseries::properties() m_series->setHorizontalPosition(1.0); m_series->setHorizontalPosition(2.0); QCOMPARE(m_series->horizontalPosition(), 1.0); - QCOMPARE(horPosSpy.count(), 2); m_series->setVerticalPosition(0.5); m_series->setVerticalPosition(-1.0); @@ -151,7 +144,6 @@ void tst_qpieseries::properties() m_series->setVerticalPosition(1.0); m_series->setVerticalPosition(2.0); QCOMPARE(m_series->verticalPosition(), 1.0); - QCOMPARE(verPosSpy.count(), 2); } void tst_qpieseries::append() diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/PieEditor.qml b/tests/qmlchartproperties/qml/qmlchartproperties/PieEditor.qml index 5195c28..37ca60f 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/PieEditor.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/PieEditor.qml @@ -41,11 +41,6 @@ Flow { id: seriesConnections target: null onVisibleChanged: console.log("series.onVisibleChanged: " + series.visible); - onHorizontalPositionChanged:console.log("series.onHorizontalPositionChanged: " + series.horizontalPosition); - onVerticalPositionChanged: console.log("series.onVerticalPositionChanged: " + series.verticalPosition); - onSizeChanged: console.log("series.onSizeChanged: " + series.size); - onStartAngleChanged: console.log("series.onStartAngleChanged: " + series.startAngle); - onEndAngleChanged: console.log("series.onEndAngleChanged: " + series.endAngle); onCountChanged: console.log("series.onCountChanged: " + series.count); onSumChanged: console.log("series.onSumChanged: " + series.sum); }