@@ -522,9 +522,8 QColor QBarSet::labelColor() | |||||
522 | */ |
|
522 | */ | |
523 | void QBarSet::setLabelColor(QColor color) |
|
523 | void QBarSet::setLabelColor(QColor color) | |
524 | { |
|
524 | { | |
525 | QBrush defaultBrush; |
|
|||
526 |
|
|
525 | QBrush b = labelBrush(); | |
527 |
if (b == |
|
526 | if (b == QBrush()) | |
528 | b.setStyle(Qt::SolidPattern); |
|
527 | b.setStyle(Qt::SolidPattern); | |
529 |
|
528 | |||
530 | if (b.color() != color) { |
|
529 | if (b.color() != color) { |
@@ -105,7 +105,7 void ChartTheme::decorate(QChart *chart) | |||||
105 | { |
|
105 | { | |
106 | QBrush brush; |
|
106 | QBrush brush; | |
107 |
|
107 | |||
108 |
if(brush == chart->backgroundBrush() |
|
108 | if(m_force || brush == chart->backgroundBrush()) | |
109 | chart->setBackgroundBrush(m_chartBackgroundGradient); |
|
109 | chart->setBackgroundBrush(m_chartBackgroundGradient); | |
110 | chart->setTitleFont(m_masterFont); |
|
110 | chart->setTitleFont(m_masterFont); | |
111 | chart->setTitleBrush(m_labelBrush); |
|
111 | chart->setTitleBrush(m_labelBrush); | |
@@ -118,16 +118,16 void ChartTheme::decorate(QLegend *legend) | |||||
118 | QBrush brush; |
|
118 | QBrush brush; | |
119 | QFont font; |
|
119 | QFont font; | |
120 |
|
120 | |||
121 |
if (pen == legend->pen() |
|
121 | if (m_force || pen == legend->pen()) | |
122 | legend->setPen(m_axisLinePen); |
|
122 | legend->setPen(m_axisLinePen); | |
123 |
|
123 | |||
124 |
if (brush == legend->brush() |
|
124 | if (m_force || brush == legend->brush()) | |
125 | legend->setBrush(m_chartBackgroundGradient); |
|
125 | legend->setBrush(m_chartBackgroundGradient); | |
126 |
|
126 | |||
127 |
if (font == legend->font() |
|
127 | if (m_force || font == legend->font()) | |
128 | legend->setFont(m_labelFont); |
|
128 | legend->setFont(m_labelFont); | |
129 |
|
129 | |||
130 |
if (brush == legend->labelBrush() |
|
130 | if (m_force || brush == legend->labelBrush()) | |
131 | legend->setLabelBrush(m_labelBrush); |
|
131 | legend->setLabelBrush(m_labelBrush); | |
132 | } |
|
132 | } | |
133 |
|
133 | |||
@@ -136,13 +136,13 void ChartTheme::decorate(QAreaSeries *series, int index) | |||||
136 | QPen pen; |
|
136 | QPen pen; | |
137 | QBrush brush; |
|
137 | QBrush brush; | |
138 |
|
138 | |||
139 |
if (pen == series->pen() |
|
139 | if (m_force || pen == series->pen()){ | |
140 | pen.setColor(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 0.0)); |
|
140 | pen.setColor(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 0.0)); | |
141 | pen.setWidthF(2); |
|
141 | pen.setWidthF(2); | |
142 | series->setPen(pen); |
|
142 | series->setPen(pen); | |
143 | } |
|
143 | } | |
144 |
|
144 | |||
145 |
if (brush == series->brush() |
|
145 | if (m_force || brush == series->brush()) { | |
146 | QBrush brush(m_seriesColors.at(index % m_seriesColors.size())); |
|
146 | QBrush brush(m_seriesColors.at(index % m_seriesColors.size())); | |
147 | series->setBrush(brush); |
|
147 | series->setBrush(brush); | |
148 | } |
|
148 | } | |
@@ -152,7 +152,7 void ChartTheme::decorate(QAreaSeries *series, int index) | |||||
152 | void ChartTheme::decorate(QLineSeries *series,int index) |
|
152 | void ChartTheme::decorate(QLineSeries *series,int index) | |
153 | { |
|
153 | { | |
154 | QPen pen; |
|
154 | QPen pen; | |
155 |
if(pen == series->pen() |
|
155 | if(m_force || pen == series->pen()){ | |
156 | pen.setColor(m_seriesColors.at(index%m_seriesColors.size())); |
|
156 | pen.setColor(m_seriesColors.at(index%m_seriesColors.size())); | |
157 | pen.setWidthF(2); |
|
157 | pen.setWidthF(2); | |
158 | series->setPen(pen); |
|
158 | series->setPen(pen); | |
@@ -184,19 +184,19 void ChartTheme::decorate(QAbstractBarSeries *series, int index) | |||||
184 | takeAtPos += step; |
|
184 | takeAtPos += step; | |
185 | takeAtPos -= (int) takeAtPos; |
|
185 | takeAtPos -= (int) takeAtPos; | |
186 | } |
|
186 | } | |
187 |
if (brush == sets.at(i)->brush() |
|
187 | if (m_force || brush == sets.at(i)->brush()) | |
188 | sets.at(i)->setBrush(colorAt(m_seriesGradients.at(colorIndex), takeAtPos)); |
|
188 | sets.at(i)->setBrush(colorAt(m_seriesGradients.at(colorIndex), takeAtPos)); | |
189 |
|
189 | |||
190 | // Pick label color from the opposite end of the gradient. |
|
190 | // Pick label color from the opposite end of the gradient. | |
191 | // 0.3 as a boundary seems to work well. |
|
191 | // 0.3 as a boundary seems to work well. | |
192 |
if (brush == sets.at(i)->labelBrush() |
|
192 | if (m_force || brush == sets.at(i)->labelBrush()) { | |
193 | if (takeAtPos < 0.3) |
|
193 | if (takeAtPos < 0.3) | |
194 | sets.at(i)->setLabelBrush(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 1)); |
|
194 | sets.at(i)->setLabelBrush(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 1)); | |
195 | else |
|
195 | else | |
196 | sets.at(i)->setLabelBrush(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 0)); |
|
196 | sets.at(i)->setLabelBrush(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 0)); | |
197 | } |
|
197 | } | |
198 |
|
198 | |||
199 |
if (pen == sets.at(i)->pen() |
|
199 | if (m_force || pen == sets.at(i)->pen()) { | |
200 | QColor c = colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 0.0); |
|
200 | QColor c = colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 0.0); | |
201 | sets.at(i)->setPen(c); |
|
201 | sets.at(i)->setPen(c); | |
202 | } |
|
202 | } | |
@@ -208,13 +208,13 void ChartTheme::decorate(QScatterSeries *series, int index) | |||||
208 | QPen pen; |
|
208 | QPen pen; | |
209 | QBrush brush; |
|
209 | QBrush brush; | |
210 |
|
210 | |||
211 |
if (pen == series->pen() |
|
211 | if (m_force || pen == series->pen()) { | |
212 | pen.setColor(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 0.0)); |
|
212 | pen.setColor(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 0.0)); | |
213 | pen.setWidthF(2); |
|
213 | pen.setWidthF(2); | |
214 | series->setPen(pen); |
|
214 | series->setPen(pen); | |
215 | } |
|
215 | } | |
216 |
|
216 | |||
217 |
if (brush == series->brush() |
|
217 | if (m_force || brush == series->brush()) { | |
218 | QBrush brush(m_seriesColors.at(index % m_seriesColors.size())); |
|
218 | QBrush brush(m_seriesColors.at(index % m_seriesColors.size())); | |
219 | series->setBrush(brush); |
|
219 | series->setBrush(brush); | |
220 | } |
|
220 | } | |
@@ -234,16 +234,16 void ChartTheme::decorate(QPieSeries *series, int index) | |||||
234 | QPieSlice *s = series->slices().at(i); |
|
234 | QPieSlice *s = series->slices().at(i); | |
235 | QPieSlicePrivate *d = QPieSlicePrivate::fromSlice(s); |
|
235 | QPieSlicePrivate *d = QPieSlicePrivate::fromSlice(s); | |
236 |
|
236 | |||
237 |
if (d->m_data.m_slicePen.isThemed() |
|
237 | if (m_force || d->m_data.m_slicePen.isThemed()) | |
238 | d->setPen(penColor, true); |
|
238 | d->setPen(penColor, true); | |
239 |
|
239 | |||
240 |
if (d->m_data.m_sliceBrush.isThemed() |
|
240 | if (m_force || d->m_data.m_sliceBrush.isThemed()) | |
241 | d->setBrush(brushColor, true); |
|
241 | d->setBrush(brushColor, true); | |
242 |
|
242 | |||
243 |
if (d->m_data.m_labelBrush.isThemed() |
|
243 | if (m_force || d->m_data.m_labelBrush.isThemed()) | |
244 | d->setLabelBrush(m_labelBrush.color(), true); |
|
244 | d->setLabelBrush(m_labelBrush.color(), true); | |
245 |
|
245 | |||
246 |
if (d->m_data.m_labelFont.isThemed() |
|
246 | if (m_force || d->m_data.m_labelFont.isThemed()) | |
247 | d->setLabelFont(m_labelFont, true); |
|
247 | d->setLabelFont(m_labelFont, true); | |
248 | } |
|
248 | } | |
249 | } |
|
249 | } | |
@@ -251,7 +251,7 void ChartTheme::decorate(QPieSeries *series, int index) | |||||
251 | void ChartTheme::decorate(QSplineSeries *series, int index) |
|
251 | void ChartTheme::decorate(QSplineSeries *series, int index) | |
252 | { |
|
252 | { | |
253 | QPen pen; |
|
253 | QPen pen; | |
254 |
if(pen == series->pen() |
|
254 | if(m_force || pen == series->pen()){ | |
255 | pen.setColor(m_seriesColors.at(index%m_seriesColors.size())); |
|
255 | pen.setColor(m_seriesColors.at(index%m_seriesColors.size())); | |
256 | pen.setWidthF(2); |
|
256 | pen.setWidthF(2); | |
257 | series->setPen(pen); |
|
257 | series->setPen(pen); | |
@@ -268,21 +268,21 void ChartTheme::decorate(QAbstractAxis *axis) | |||||
268 |
|
268 | |||
269 | if (axis->isArrowVisible()) { |
|
269 | if (axis->isArrowVisible()) { | |
270 |
|
270 | |||
271 |
if(brush == axis->labelsBrush() |
|
271 | if(m_force || brush == axis->labelsBrush()){ | |
272 | axis->setLabelsBrush(m_labelBrush); |
|
272 | axis->setLabelsBrush(m_labelBrush); | |
273 | } |
|
273 | } | |
274 |
if(pen == axis->labelsPen() |
|
274 | if(m_force || pen == axis->labelsPen()){ | |
275 | axis->setLabelsPen(Qt::NoPen); // NoPen for performance reasons |
|
275 | axis->setLabelsPen(Qt::NoPen); // NoPen for performance reasons | |
276 | } |
|
276 | } | |
277 |
|
277 | |||
278 |
|
278 | |||
279 |
if (axis->shadesVisible() |
|
279 | if (m_force || axis->shadesVisible()) { | |
280 |
|
280 | |||
281 |
if(brush == axis->shadesBrush() |
|
281 | if(m_force || brush == axis->shadesBrush()){ | |
282 | axis->setShadesBrush(m_backgroundShadesBrush); |
|
282 | axis->setShadesBrush(m_backgroundShadesBrush); | |
283 | } |
|
283 | } | |
284 |
|
284 | |||
285 |
if(pen == axis->shadesPen() |
|
285 | if(m_force || pen == axis->shadesPen()){ | |
286 | axis->setShadesPen(m_backgroundShadesPen); |
|
286 | axis->setShadesPen(m_backgroundShadesPen); | |
287 | } |
|
287 | } | |
288 |
|
288 | |||
@@ -294,15 +294,15 void ChartTheme::decorate(QAbstractAxis *axis) | |||||
294 | } |
|
294 | } | |
295 | } |
|
295 | } | |
296 |
|
296 | |||
297 |
if(pen == axis->axisPen() |
|
297 | if(m_force || pen == axis->axisPen()){ | |
298 | axis->setAxisPen(m_axisLinePen); |
|
298 | axis->setAxisPen(m_axisLinePen); | |
299 | } |
|
299 | } | |
300 |
|
300 | |||
301 |
if(pen == axis->gridLinePen() |
|
301 | if(m_force || pen == axis->gridLinePen()){ | |
302 | axis->setGridLinePen(m_gridLinePen); |
|
302 | axis->setGridLinePen(m_gridLinePen); | |
303 | } |
|
303 | } | |
304 |
|
304 | |||
305 |
if(font == axis->labelsFont() |
|
305 | if(m_force || font == axis->labelsFont()){ | |
306 | axis->setLabelsFont(m_labelFont); |
|
306 | axis->setLabelsFont(m_labelFont); | |
307 | } |
|
307 | } | |
308 | } |
|
308 | } |
General Comments 0
You need to be logged in to leave comments.
Login now