From bc1381ca9ce2ea85fd0bccf501e38b8bbb2c879d 2012-01-31 14:31:07 From: sauimone Date: 2012-01-31 14:31:07 Subject: [PATCH] adopted theme interface to barcharts --- diff --git a/src/barchart/bargroup.cpp b/src/barchart/bargroup.cpp index fb2e727..9da9083 100644 --- a/src/barchart/bargroup.cpp +++ b/src/barchart/bargroup.cpp @@ -32,7 +32,8 @@ void BarGroup::setPlotDomain(const PlotDomain& data) void BarGroup::setTheme(ChartTheme *theme) { - // TODO + qDebug() << "BarGroup::setTheme"; + // TODO: } void BarGroup::setBarWidth( int w ) diff --git a/src/barchart/percentbargroup.cpp b/src/barchart/percentbargroup.cpp index 72ec026..e8ff476 100644 --- a/src/barchart/percentbargroup.cpp +++ b/src/barchart/percentbargroup.cpp @@ -30,6 +30,12 @@ void PercentBarGroup::setPlotDomain(const PlotDomain& data) // TODO: } +void PercentBarGroup::setTheme(ChartTheme *theme) +{ + qDebug() << "PercentBarGroup::setTheme"; + // TODO: +} + void PercentBarGroup::setBarWidth( int w ) { mBarDefaultWidth = w; diff --git a/src/barchart/stackedbargroup.cpp b/src/barchart/stackedbargroup.cpp index 37d5835..e0b74cb 100644 --- a/src/barchart/stackedbargroup.cpp +++ b/src/barchart/stackedbargroup.cpp @@ -30,6 +30,12 @@ void StackedBarGroup::setPlotDomain(const PlotDomain& data) // TODO: } +void StackedBarGroup::setTheme(ChartTheme *theme) +{ + qDebug() << "StackedBarGroup::setTheme"; + // TODO: +} + void StackedBarGroup::setBarWidth( int w ) { mBarDefaultWidth = w; diff --git a/src/barchart/stackedbargroup.h b/src/barchart/stackedbargroup.h index 0c18b1c..2960692 100644 --- a/src/barchart/stackedbargroup.h +++ b/src/barchart/stackedbargroup.h @@ -8,6 +8,7 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE +// TODO: derive this from ChartObjectInterface, when setSize is back in ChartItem class StackedBarGroup : public ChartItem { public: diff --git a/src/chartitem_p.h b/src/chartitem_p.h index 18be17f..f33b883 100644 --- a/src/chartitem_p.h +++ b/src/chartitem_p.h @@ -6,7 +6,8 @@ #include QTCOMMERCIALCHART_BEGIN_NAMESPACE - +// TODO: setSize and set plotDomain back here. Derive this only from QGraphicsItem +// class ChartItem : public QGraphicsItem class ChartItem : public QGraphicsItem, public ChartObjectInterface { enum ChartItemTypes{ AXIS_ITEM = UserType+1, XYLINE_ITEM}; diff --git a/src/chartobjectinterface_p.h b/src/chartobjectinterface_p.h index 9d7de86..1946162 100644 --- a/src/chartobjectinterface_p.h +++ b/src/chartobjectinterface_p.h @@ -18,6 +18,7 @@ class PlotDomain; class ChartObjectInterface { public: +// TODO: move setSize and setPlotDomain back to ChartItem. This interface should be only about handling themes. virtual void setSize(const QSize &size) = 0; virtual void setTheme(ChartTheme *theme) = 0; virtual void setPlotDomain(const PlotDomain& data) = 0; diff --git a/src/qchart.cpp b/src/qchart.cpp index 57504c0..71cefb7 100644 --- a/src/qchart.cpp +++ b/src/qchart.cpp @@ -100,14 +100,14 @@ void QChart::addSeries(QChartSeries* series) m_chartObjectInterfaces << barGroup; childItems().append(barGroup); - +/* m_plotDataIndex = 0 ; m_plotDomainList.resize(1); PlotDomain& domain = m_plotDomainList[m_plotDataIndex]; foreach(ChartItem* i ,m_chartItems) i->setPlotDomain(m_plotDomainList.at(m_plotDataIndex)); - +*/ break; } case QChartSeries::SeriesTypeStackedBar: { @@ -125,13 +125,14 @@ void QChart::addSeries(QChartSeries* series) m_chartObjectInterfaces << stackedBarGroup; childItems().append(stackedBarGroup); +/* m_plotDataIndex = 0 ; m_plotDomainList.resize(1); PlotDomain& domain = m_plotDomainList[m_plotDataIndex]; foreach(ChartItem* i ,m_chartItems) i->setPlotDomain(m_plotDomainList.at(m_plotDataIndex)); - +*/ break; } case QChartSeries::SeriesTypePercentBar: { @@ -149,13 +150,14 @@ void QChart::addSeries(QChartSeries* series) m_chartObjectInterfaces << percentBarGroup; childItems().append(percentBarGroup); +/* m_plotDataIndex = 0 ; m_plotDomainList.resize(1); PlotDomain& domain = m_plotDomainList[m_plotDataIndex]; foreach(ChartItem* i ,m_chartItems) i->setPlotDomain(m_plotDomainList.at(m_plotDataIndex)); - +*/ break; } case QChartSeries::SeriesTypeScatter: {