diff --git a/src/legend/qlegend.cpp b/src/legend/qlegend.cpp index 94263e8..00b083e 100644 --- a/src/legend/qlegend.cpp +++ b/src/legend/qlegend.cpp @@ -386,16 +386,6 @@ QList QLegend::markers(QAbstractSeries *series) const return d_ptr->markers(series); } -void QLegend::addSeries(QAbstractSeries *series) -{ - d_ptr->addSeries(series); -} - -void QLegend::removeSeries(QAbstractSeries *series) -{ - d_ptr->removeSeries(series); -} - /*! \internal \a event see QGraphicsWidget for details */ @@ -474,9 +464,8 @@ QList QLegendPrivate::markers(QAbstractSeries *series) return markers; } -void QLegendPrivate::addSeries(QAbstractSeries *series) +void QLegendPrivate::handleSeriesAdded(QAbstractSeries *series) { - // Only allow one instance of series if (m_series.contains(series)) { return; } @@ -493,7 +482,7 @@ void QLegendPrivate::addSeries(QAbstractSeries *series) m_layout->invalidate(); } -void QLegendPrivate::removeSeries(QAbstractSeries *series) +void QLegendPrivate::handleSeriesRemoved(QAbstractSeries *series) { if (m_series.contains(series)) { m_series.removeOne(series); @@ -514,20 +503,6 @@ void QLegendPrivate::removeSeries(QAbstractSeries *series) m_layout->invalidate(); } -void QLegendPrivate::handleSeriesAdded(QAbstractSeries *series) -{ - // Moved to appendSeries - // This slot is just to make old code work for now. - addSeries(series); -} - -void QLegendPrivate::handleSeriesRemoved(QAbstractSeries *series) -{ - // Moved to removeSeries - // This slot is just to make old code work for now. - removeSeries(series); -} - void QLegendPrivate::handleSeriesVisibleChanged() { QAbstractSeries *series = qobject_cast (sender()); diff --git a/src/legend/qlegend.h b/src/legend/qlegend.h index d33b0b9..33a8492 100644 --- a/src/legend/qlegend.h +++ b/src/legend/qlegend.h @@ -79,10 +79,7 @@ public: void setBackgroundVisible(bool visible = true); bool isBackgroundVisible() const; - // New stuff: QList markers(QAbstractSeries *series = 0) const; - void addSeries(QAbstractSeries *series); - void removeSeries(QAbstractSeries *series); protected: void hideEvent(QHideEvent *event); diff --git a/src/legend/qlegend_p.h b/src/legend/qlegend_p.h index d696233..9b68ca0 100644 --- a/src/legend/qlegend_p.h +++ b/src/legend/qlegend_p.h @@ -55,8 +55,6 @@ public: QGraphicsItemGroup* items() { return m_items; } QList markers(QAbstractSeries *series = 0); - void addSeries(QAbstractSeries *series); - void removeSeries(QAbstractSeries *series); public Q_SLOTS: void handleSeriesAdded(QAbstractSeries *series); diff --git a/tests/auto/qlegend/tst_qlegend.cpp b/tests/auto/qlegend/tst_qlegend.cpp index 2a09d8e..50bbb7e 100644 --- a/tests/auto/qlegend/tst_qlegend.cpp +++ b/tests/auto/qlegend/tst_qlegend.cpp @@ -277,12 +277,12 @@ void tst_QLegend::addAndRemoveSeries() pie->append(QString("slice2"), 2); pie->append(QString("slice3"), 3); - legend->addSeries(pie); + m_chart->addSeries(pie); QList markers = legend->markers(); QVERIFY(markers.count() == 3); - legend->removeSeries(pie); + m_chart->removeSeries(pie); markers = legend->markers(); QVERIFY(markers.count() == 0);