diff --git a/src/qchart.cpp b/src/qchart.cpp index 2913436..46fdb9b 100644 --- a/src/qchart.cpp +++ b/src/qchart.cpp @@ -92,6 +92,8 @@ QChart::~QChart() Adds the \a series and optional \a axisY onto the chart and takes the ownership of the objects. If auto scaling is enabled, re-scales the axes the series is bound to (both the x axis and the y axis). + + \sa removeSeries(), removeAllSeries() */ void QChart::addSeries(QAbstractSeries *series, QAxis *axisY) { @@ -439,6 +441,11 @@ bool QChart::isBackgroundDropShadowEnabled() const return d_ptr->m_presenter->m_backgroundItem->isDropShadowEnabled(); } +/*! + Returns all the series that are added to the chart. + + \sa addSeries(), removeSeries(), removeAllSeries() +*/ QList QChart::series() const { return d_ptr->m_dataset->series(); diff --git a/tests/auto/qchart/tst_qchart.cpp b/tests/auto/qchart/tst_qchart.cpp index fb69925..2fc6a62 100644 --- a/tests/auto/qchart/tst_qchart.cpp +++ b/tests/auto/qchart/tst_qchart.cpp @@ -204,11 +204,15 @@ void tst_QChart::addSeries() QTest::qWaitForWindowShown(m_view); if(!axis) axis = m_chart->axisY(); QVERIFY(!series->chart()); + QCOMPARE(m_chart->series().count(), 0); m_chart->addSeries(series,axis); + QCOMPARE(m_chart->series().count(), 1); + QCOMPARE(m_chart->series().first(), series); QVERIFY(series->chart() == m_chart); QCOMPARE(m_chart->axisY(series),axis); m_chart->removeSeries(series); QVERIFY(!series->chart()); + QCOMPARE(m_chart->series().count(), 0); } void tst_QChart::animationOptions_data()