From c3223f1ab305e483cf14a5e372536e2382000517 2012-02-08 09:47:59 From: Michal Klocek Date: 2012-02-08 09:47:59 Subject: [PATCH] Remove obsolete setBackgroundColor form QChart --- diff --git a/src/qchart.cpp b/src/qchart.cpp index b79bf25..8fc3efe 100644 --- a/src/qchart.cpp +++ b/src/qchart.cpp @@ -242,30 +242,6 @@ QChartSeries* QChart::createSeries(QChartSeries::QChartSeriesType type) return series; } -void QChart::setBackground(const QColor& startColor, const QColor& endColor, GradientOrientation orientation) -{ - - if(!m_backgroundItem){ - m_backgroundItem = new QGraphicsRectItem(this); - m_backgroundItem->setZValue(-1); - } - - m_bacgroundOrinetation = orientation; - m_backgroundGradient.setColorAt(0.0, startColor); - m_backgroundGradient.setColorAt(1.0, endColor); - m_backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); - - if(orientation == VerticalGradientOrientation){ - m_backgroundGradient.setFinalStop(0,1); - }else{ - m_backgroundGradient.setFinalStop(1,0); - } - - m_backgroundItem->setBrush(m_backgroundGradient); - m_backgroundItem->setPen(Qt::NoPen); - m_backgroundItem->update(); -} - void QChart::setChartBackgroundBrush(const QBrush& brush) { @@ -310,9 +286,12 @@ void QChart::setMargin(int margin) void QChart::setTheme(QChart::ChartThemeId theme) { m_chartTheme->setTheme(theme); - setBackground(m_chartTheme->d->m_gradientStartColor, - m_chartTheme->d->m_gradientEndColor, - m_bacgroundOrinetation); + + QLinearGradient backgroundGradient; + backgroundGradient.setColorAt(0.0, m_chartTheme->d->m_gradientStartColor); + backgroundGradient.setColorAt(1.0, m_chartTheme->d->m_gradientEndColor); + backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); + setChartBackgroundBrush(backgroundGradient); // TODO: Move the controlling of the series presentations into private implementation of the // series instead of QChart controlling themes for each diff --git a/src/qchart.h b/src/qchart.h index 53a27af..1e26f9f 100644 --- a/src/qchart.h +++ b/src/qchart.h @@ -64,10 +64,6 @@ public: QChart::ChartThemeId theme(); void setTitle(const QString& title,const QFont& font = QFont()); - - //Obsolete interface - void setBackground(const QColor& startColor, const QColor& endColor = Qt::white, GradientOrientation orientation = VerticalGradientOrientation); - void setChartBackgroundBrush(const QBrush& brush); void setChartBackgroundPen(const QPen& pen); @@ -89,7 +85,6 @@ private: private: Q_DISABLE_COPY(QChart) QGraphicsRectItem* m_backgroundItem; - QLinearGradient m_backgroundGradient; GradientOrientation m_bacgroundOrinetation; QGraphicsTextItem* m_titleItem; AxisItem* m_axisXItem; diff --git a/src/qchartview.cpp b/src/qchartview.cpp index b17d4fc..f857052 100644 --- a/src/qchartview.cpp +++ b/src/qchartview.cpp @@ -72,11 +72,6 @@ void QChartView::setTitle(const QString& title) m_chart->setTitle(title); } -void QChartView::setBackground(const QColor& startColor, const QColor& endColor, QChart::GradientOrientation orientation) -{ - m_chart->setBackground(startColor,endColor,orientation); -} - void QChartView::setChartBackgroundBrush(const QBrush& brush) { m_chart->setChartBackgroundBrush(brush); diff --git a/src/qchartview.h b/src/qchartview.h index 2becc04..dbf36e4 100644 --- a/src/qchartview.h +++ b/src/qchartview.h @@ -32,10 +32,6 @@ public: int margin() const; void setTitle(const QString& title); - - //Obsolete interface - void setBackground(const QColor& startColor, const QColor& endColor = Qt::white, QChart::GradientOrientation orientation = QChart::VerticalGradientOrientation); - void setChartBackgroundBrush(const QBrush& brush); void setChartBackgroundPen(const QPen& pen);