From 3de587f7271d20641dc2f89bf836ab38294b4339 2012-10-17 07:46:22 From: sauimone Date: 2012-10-17 07:46:22 Subject: [PATCH] Areaseries uses new legendmarkers --- diff --git a/src/areachart/qareaseries.cpp b/src/areachart/qareaseries.cpp index d98c5d4..8f2c2ab 100644 --- a/src/areachart/qareaseries.cpp +++ b/src/areachart/qareaseries.cpp @@ -28,6 +28,8 @@ #include "charttheme_p.h" #include "qvalueaxis.h" +#include "qarealegendmarker.h" + QTCOMMERCIALCHART_BEGIN_NAMESPACE /*! @@ -384,12 +386,9 @@ QList QAreaSeriesPrivate::createLegendMarker(QLegend *legend) QList QAreaSeriesPrivate::createLegendMarkers(QLegend* legend) { - Q_UNUSED(legend); -// Q_Q(QAreaSeries); + Q_Q(QAreaSeries); QList list; -// TODO: -// return list << new AreaLegendMarker(q,legend); - return list; + return list << new QAreaLegendMarker(q,legend); } void QAreaSeriesPrivate::initializeAxis(QAbstractAxis *axis) diff --git a/src/legend/qarealegendmarker.cpp b/src/legend/qarealegendmarker.cpp index 84084ed..a8c14a3 100644 --- a/src/legend/qarealegendmarker.cpp +++ b/src/legend/qarealegendmarker.cpp @@ -62,6 +62,7 @@ QAreaLegendMarkerPrivate::QAreaLegendMarkerPrivate(QAreaLegendMarker *q, QAreaSe QLegendMarkerPrivate(q,legend), m_series(series) { + qDebug() << "QAreaLegendMarkerPrivate created"; QObject::connect(m_series->d_func(),SIGNAL(updated()), this, SLOT(updated())); QObject::connect(m_series, SIGNAL(nameChanged()), this, SLOT(updated())); updated(); @@ -75,6 +76,7 @@ QAreaLegendMarkerPrivate::~QAreaLegendMarkerPrivate() void QAreaLegendMarkerPrivate::updated() { + qDebug() << "QAreaLegendMarkerPrivate::updated"; m_item->setBrush(m_series->brush()); m_item->setLabel(m_series->name()); } diff --git a/src/legend/qlegend.cpp b/src/legend/qlegend.cpp index 413024a..a2415e7 100644 --- a/src/legend/qlegend.cpp +++ b/src/legend/qlegend.cpp @@ -511,14 +511,13 @@ void QLegendPrivate::appendSeries(QAbstractSeries* series) QObject::connect(s, SIGNAL(countChanged()), this, SLOT(handleSeriesUpdated())); break; } - // TODO: case QAbstractSeries::SeriesTypeLine: case QAbstractSeries::SeriesTypeArea: case QAbstractSeries::SeriesTypeScatter: case QAbstractSeries::SeriesTypeSpline: default: { - // No need to connect any series related signals? - qDebug() << "Not yet implemented"; + // No need to connect any series related signals. We have no series level + // changes, that would generate or delete markers } } @@ -567,7 +566,7 @@ void QLegendPrivate::removeSeries(QAbstractSeries* series) case QAbstractSeries::SeriesTypeScatter: case QAbstractSeries::SeriesTypeSpline: default: { - // No need to disconnect any series related signals? + // No need to disconnect any series related signals break; } } @@ -610,7 +609,7 @@ void QLegendPrivate::handleSeriesVisibleChanged() void QLegendPrivate::handleCountChanged() { // TODO: With new markers, the series should notify markers directly. - // TODO: Better way to handle updates + // TODO: Better way to handle updates. Remove/Add series again seems like overkill. QAbstractSeries *series = qobject_cast (sender()); qDebug() << "QLegendPrivate::handleSeriesUpdated" << series;