@@ -242,30 +242,6 QChartSeries* QChart::createSeries(QChartSeries::QChartSeriesType type) | |||||
242 | return series; |
|
242 | return series; | |
243 | } |
|
243 | } | |
244 |
|
244 | |||
245 | void QChart::setBackground(const QColor& startColor, const QColor& endColor, GradientOrientation orientation) |
|
|||
246 | { |
|
|||
247 |
|
||||
248 | if(!m_backgroundItem){ |
|
|||
249 | m_backgroundItem = new QGraphicsRectItem(this); |
|
|||
250 | m_backgroundItem->setZValue(-1); |
|
|||
251 | } |
|
|||
252 |
|
||||
253 | m_bacgroundOrinetation = orientation; |
|
|||
254 | m_backgroundGradient.setColorAt(0.0, startColor); |
|
|||
255 | m_backgroundGradient.setColorAt(1.0, endColor); |
|
|||
256 | m_backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
|||
257 |
|
||||
258 | if(orientation == VerticalGradientOrientation){ |
|
|||
259 | m_backgroundGradient.setFinalStop(0,1); |
|
|||
260 | }else{ |
|
|||
261 | m_backgroundGradient.setFinalStop(1,0); |
|
|||
262 | } |
|
|||
263 |
|
||||
264 | m_backgroundItem->setBrush(m_backgroundGradient); |
|
|||
265 | m_backgroundItem->setPen(Qt::NoPen); |
|
|||
266 | m_backgroundItem->update(); |
|
|||
267 | } |
|
|||
268 |
|
||||
269 | void QChart::setChartBackgroundBrush(const QBrush& brush) |
|
245 | void QChart::setChartBackgroundBrush(const QBrush& brush) | |
270 | { |
|
246 | { | |
271 |
|
247 | |||
@@ -310,9 +286,12 void QChart::setMargin(int margin) | |||||
310 | void QChart::setTheme(QChart::ChartThemeId theme) |
|
286 | void QChart::setTheme(QChart::ChartThemeId theme) | |
311 | { |
|
287 | { | |
312 | m_chartTheme->setTheme(theme); |
|
288 | m_chartTheme->setTheme(theme); | |
313 | setBackground(m_chartTheme->d->m_gradientStartColor, |
|
289 | ||
314 | m_chartTheme->d->m_gradientEndColor, |
|
290 | QLinearGradient backgroundGradient; | |
315 | m_bacgroundOrinetation); |
|
291 | backgroundGradient.setColorAt(0.0, m_chartTheme->d->m_gradientStartColor); | |
|
292 | backgroundGradient.setColorAt(1.0, m_chartTheme->d->m_gradientEndColor); | |||
|
293 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |||
|
294 | setChartBackgroundBrush(backgroundGradient); | |||
316 |
|
295 | |||
317 | // TODO: Move the controlling of the series presentations into private implementation of the |
|
296 | // TODO: Move the controlling of the series presentations into private implementation of the | |
318 | // series instead of QChart controlling themes for each |
|
297 | // series instead of QChart controlling themes for each |
@@ -64,10 +64,6 public: | |||||
64 | QChart::ChartThemeId theme(); |
|
64 | QChart::ChartThemeId theme(); | |
65 |
|
65 | |||
66 | void setTitle(const QString& title,const QFont& font = QFont()); |
|
66 | void setTitle(const QString& title,const QFont& font = QFont()); | |
67 |
|
||||
68 | //Obsolete interface |
|
|||
69 | void setBackground(const QColor& startColor, const QColor& endColor = Qt::white, GradientOrientation orientation = VerticalGradientOrientation); |
|
|||
70 |
|
||||
71 | void setChartBackgroundBrush(const QBrush& brush); |
|
67 | void setChartBackgroundBrush(const QBrush& brush); | |
72 | void setChartBackgroundPen(const QPen& pen); |
|
68 | void setChartBackgroundPen(const QPen& pen); | |
73 |
|
69 | |||
@@ -89,7 +85,6 private: | |||||
89 | private: |
|
85 | private: | |
90 | Q_DISABLE_COPY(QChart) |
|
86 | Q_DISABLE_COPY(QChart) | |
91 | QGraphicsRectItem* m_backgroundItem; |
|
87 | QGraphicsRectItem* m_backgroundItem; | |
92 | QLinearGradient m_backgroundGradient; |
|
|||
93 | GradientOrientation m_bacgroundOrinetation; |
|
88 | GradientOrientation m_bacgroundOrinetation; | |
94 | QGraphicsTextItem* m_titleItem; |
|
89 | QGraphicsTextItem* m_titleItem; | |
95 | AxisItem* m_axisXItem; |
|
90 | AxisItem* m_axisXItem; |
@@ -72,11 +72,6 void QChartView::setTitle(const QString& title) | |||||
72 | m_chart->setTitle(title); |
|
72 | m_chart->setTitle(title); | |
73 | } |
|
73 | } | |
74 |
|
74 | |||
75 | void QChartView::setBackground(const QColor& startColor, const QColor& endColor, QChart::GradientOrientation orientation) |
|
|||
76 | { |
|
|||
77 | m_chart->setBackground(startColor,endColor,orientation); |
|
|||
78 | } |
|
|||
79 |
|
||||
80 | void QChartView::setChartBackgroundBrush(const QBrush& brush) |
|
75 | void QChartView::setChartBackgroundBrush(const QBrush& brush) | |
81 | { |
|
76 | { | |
82 | m_chart->setChartBackgroundBrush(brush); |
|
77 | m_chart->setChartBackgroundBrush(brush); |
@@ -32,10 +32,6 public: | |||||
32 | int margin() const; |
|
32 | int margin() const; | |
33 |
|
33 | |||
34 | void setTitle(const QString& title); |
|
34 | void setTitle(const QString& title); | |
35 |
|
||||
36 | //Obsolete interface |
|
|||
37 | void setBackground(const QColor& startColor, const QColor& endColor = Qt::white, QChart::GradientOrientation orientation = QChart::VerticalGradientOrientation); |
|
|||
38 |
|
||||
39 | void setChartBackgroundBrush(const QBrush& brush); |
|
35 | void setChartBackgroundBrush(const QBrush& brush); | |
40 | void setChartBackgroundPen(const QPen& pen); |
|
36 | void setChartBackgroundPen(const QPen& pen); | |
41 |
|
37 |
General Comments 0
You need to be logged in to leave comments.
Login now