@@ -283,6 +283,7 void ChartPresenter::setChartTheme(QChart::ChartTheme theme) | |||||
283 | if(m_chartTheme && m_chartTheme->id() == theme) return; |
|
283 | if(m_chartTheme && m_chartTheme->id() == theme) return; | |
284 | delete m_chartTheme; |
|
284 | delete m_chartTheme; | |
285 | m_chartTheme = ChartTheme::createTheme(theme); |
|
285 | m_chartTheme = ChartTheme::createTheme(theme); | |
|
286 | m_chartTheme->decorate(m_chart); | |||
286 | resetAllElements(); |
|
287 | resetAllElements(); | |
287 | } |
|
288 | } | |
288 |
|
289 |
@@ -63,63 +63,7 void ChartTheme::decorate(QChart* chart) | |||||
63 | { |
|
63 | { | |
64 | chart->setChartBackgroundBrush(m_backgroundGradient); |
|
64 | chart->setChartBackgroundBrush(m_backgroundGradient); | |
65 | } |
|
65 | } | |
66 | /* |
|
|||
67 | //TODO helper to by removed later |
|
|||
68 | void ChartTheme::decorate(ChartItem* item, QSeries* series,int count) |
|
|||
69 | { |
|
|||
70 | switch(series->type()) |
|
|||
71 | { |
|
|||
72 | case QSeries::SeriesTypeLine: { |
|
|||
73 | QLineSeries* s = static_cast<QLineSeries*>(series); |
|
|||
74 | LineChartItem* i = static_cast<LineChartItem*>(item); |
|
|||
75 | decorate(i,s,count); |
|
|||
76 | break; |
|
|||
77 | } |
|
|||
78 | case QSeries::SeriesTypeArea: { |
|
|||
79 | QAreaSeries* s = static_cast<QAreaSeries*>(series); |
|
|||
80 | AreaChartItem* i = static_cast<AreaChartItem*>(item); |
|
|||
81 | decorate(i,s,count); |
|
|||
82 | break; |
|
|||
83 | } |
|
|||
84 | case QSeries::SeriesTypeBar: { |
|
|||
85 | QBarSeries* b = static_cast<QBarSeries*>(series); |
|
|||
86 | BarPresenter* i = static_cast<BarPresenter*>(item); |
|
|||
87 | decorate(i,b,count); |
|
|||
88 | break; |
|
|||
89 | } |
|
|||
90 | case QSeries::SeriesTypeStackedBar: { |
|
|||
91 | QStackedBarSeries* s = static_cast<QStackedBarSeries*>(series); |
|
|||
92 | StackedBarPresenter* i = static_cast<StackedBarPresenter*>(item); |
|
|||
93 | decorate(i,s,count); |
|
|||
94 | break; |
|
|||
95 | } |
|
|||
96 | case QSeries::SeriesTypePercentBar: { |
|
|||
97 | QPercentBarSeries* s = static_cast<QPercentBarSeries*>(series); |
|
|||
98 | PercentBarPresenter* i = static_cast<PercentBarPresenter*>(item); |
|
|||
99 | decorate(i,s,count); |
|
|||
100 | break; |
|
|||
101 | } |
|
|||
102 | case QSeries::SeriesTypeScatter: { |
|
|||
103 | QScatterSeries* s = qobject_cast<QScatterSeries*>(series); |
|
|||
104 | Q_ASSERT(s); |
|
|||
105 | ScatterChartItem* i = static_cast<ScatterChartItem*>(item); |
|
|||
106 | Q_ASSERT(i); |
|
|||
107 | decorate(i, s, count); |
|
|||
108 | break; |
|
|||
109 | } |
|
|||
110 | case QSeries::SeriesTypePie: { |
|
|||
111 | QPieSeries* s = static_cast<QPieSeries*>(series); |
|
|||
112 | PiePresenter* i = static_cast<PiePresenter*>(item); |
|
|||
113 | decorate(i,s,count); |
|
|||
114 | break; |
|
|||
115 | } |
|
|||
116 | default: |
|
|||
117 | qDebug()<<"Wrong item to be decorated by theme"; |
|
|||
118 | break; |
|
|||
119 | } |
|
|||
120 |
|
66 | |||
121 | } |
|
|||
122 | */ |
|
|||
123 | void ChartTheme::decorate(AreaChartItem* item, QAreaSeries* series,int count) |
|
67 | void ChartTheme::decorate(AreaChartItem* item, QAreaSeries* series,int count) | |
124 | { |
|
68 | { | |
125 | QPen pen; |
|
69 | QPen pen; |
General Comments 0
You need to be logged in to leave comments.
Login now