@@ -521,10 +521,9 QColor QBarSet::labelColor() | |||
|
521 | 521 | Sets the color of labels for this barset |
|
522 | 522 | */ |
|
523 | 523 | void QBarSet::setLabelColor(QColor color) |
|
524 | { | |
|
525 | QBrush defaultBrush; | |
|
524 | { | |
|
526 | 525 |
|
|
527 |
if (b == |
|
|
526 | if (b == QBrush()) | |
|
528 | 527 | b.setStyle(Qt::SolidPattern); |
|
529 | 528 | |
|
530 | 529 | if (b.color() != color) { |
@@ -105,7 +105,7 void ChartTheme::decorate(QChart *chart) | |||
|
105 | 105 | { |
|
106 | 106 | QBrush brush; |
|
107 | 107 | |
|
108 |
if(brush == chart->backgroundBrush() |
|
|
108 | if(m_force || brush == chart->backgroundBrush()) | |
|
109 | 109 | chart->setBackgroundBrush(m_chartBackgroundGradient); |
|
110 | 110 | chart->setTitleFont(m_masterFont); |
|
111 | 111 | chart->setTitleBrush(m_labelBrush); |
@@ -118,16 +118,16 void ChartTheme::decorate(QLegend *legend) | |||
|
118 | 118 | QBrush brush; |
|
119 | 119 | QFont font; |
|
120 | 120 | |
|
121 |
if (pen == legend->pen() |
|
|
121 | if (m_force || pen == legend->pen()) | |
|
122 | 122 | legend->setPen(m_axisLinePen); |
|
123 | 123 | |
|
124 |
if (brush == legend->brush() |
|
|
124 | if (m_force || brush == legend->brush()) | |
|
125 | 125 | legend->setBrush(m_chartBackgroundGradient); |
|
126 | 126 | |
|
127 |
if (font == legend->font() |
|
|
127 | if (m_force || font == legend->font()) | |
|
128 | 128 | legend->setFont(m_labelFont); |
|
129 | 129 | |
|
130 |
if (brush == legend->labelBrush() |
|
|
130 | if (m_force || brush == legend->labelBrush()) | |
|
131 | 131 | legend->setLabelBrush(m_labelBrush); |
|
132 | 132 | } |
|
133 | 133 | |
@@ -136,13 +136,13 void ChartTheme::decorate(QAreaSeries *series, int index) | |||
|
136 | 136 | QPen pen; |
|
137 | 137 | QBrush brush; |
|
138 | 138 | |
|
139 |
if (pen == series->pen() |
|
|
139 | if (m_force || pen == series->pen()){ | |
|
140 | 140 | pen.setColor(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 0.0)); |
|
141 | 141 | pen.setWidthF(2); |
|
142 | 142 | series->setPen(pen); |
|
143 | 143 | } |
|
144 | 144 | |
|
145 |
if (brush == series->brush() |
|
|
145 | if (m_force || brush == series->brush()) { | |
|
146 | 146 | QBrush brush(m_seriesColors.at(index % m_seriesColors.size())); |
|
147 | 147 | series->setBrush(brush); |
|
148 | 148 | } |
@@ -152,7 +152,7 void ChartTheme::decorate(QAreaSeries *series, int index) | |||
|
152 | 152 | void ChartTheme::decorate(QLineSeries *series,int index) |
|
153 | 153 | { |
|
154 | 154 | QPen pen; |
|
155 |
if(pen == series->pen() |
|
|
155 | if(m_force || pen == series->pen()){ | |
|
156 | 156 | pen.setColor(m_seriesColors.at(index%m_seriesColors.size())); |
|
157 | 157 | pen.setWidthF(2); |
|
158 | 158 | series->setPen(pen); |
@@ -184,19 +184,19 void ChartTheme::decorate(QAbstractBarSeries *series, int index) | |||
|
184 | 184 | takeAtPos += step; |
|
185 | 185 | takeAtPos -= (int) takeAtPos; |
|
186 | 186 | } |
|
187 |
if (brush == sets.at(i)->brush() |
|
|
187 | if (m_force || brush == sets.at(i)->brush()) | |
|
188 | 188 | sets.at(i)->setBrush(colorAt(m_seriesGradients.at(colorIndex), takeAtPos)); |
|
189 | 189 | |
|
190 | 190 | // Pick label color from the opposite end of the gradient. |
|
191 | 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 | 193 | if (takeAtPos < 0.3) |
|
194 | 194 | sets.at(i)->setLabelBrush(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 1)); |
|
195 | 195 | else |
|
196 | 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 | 200 | QColor c = colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 0.0); |
|
201 | 201 | sets.at(i)->setPen(c); |
|
202 | 202 | } |
@@ -208,13 +208,13 void ChartTheme::decorate(QScatterSeries *series, int index) | |||
|
208 | 208 | QPen pen; |
|
209 | 209 | QBrush brush; |
|
210 | 210 | |
|
211 |
if (pen == series->pen() |
|
|
211 | if (m_force || pen == series->pen()) { | |
|
212 | 212 | pen.setColor(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 0.0)); |
|
213 | 213 | pen.setWidthF(2); |
|
214 | 214 | series->setPen(pen); |
|
215 | 215 | } |
|
216 | 216 | |
|
217 |
if (brush == series->brush() |
|
|
217 | if (m_force || brush == series->brush()) { | |
|
218 | 218 | QBrush brush(m_seriesColors.at(index % m_seriesColors.size())); |
|
219 | 219 | series->setBrush(brush); |
|
220 | 220 | } |
@@ -234,16 +234,16 void ChartTheme::decorate(QPieSeries *series, int index) | |||
|
234 | 234 | QPieSlice *s = series->slices().at(i); |
|
235 | 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 | 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 | 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 | 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 | 247 | d->setLabelFont(m_labelFont, true); |
|
248 | 248 | } |
|
249 | 249 | } |
@@ -251,7 +251,7 void ChartTheme::decorate(QPieSeries *series, int index) | |||
|
251 | 251 | void ChartTheme::decorate(QSplineSeries *series, int index) |
|
252 | 252 | { |
|
253 | 253 | QPen pen; |
|
254 |
if(pen == series->pen() |
|
|
254 | if(m_force || pen == series->pen()){ | |
|
255 | 255 | pen.setColor(m_seriesColors.at(index%m_seriesColors.size())); |
|
256 | 256 | pen.setWidthF(2); |
|
257 | 257 | series->setPen(pen); |
@@ -268,21 +268,21 void ChartTheme::decorate(QAbstractAxis *axis) | |||
|
268 | 268 | |
|
269 | 269 | if (axis->isArrowVisible()) { |
|
270 | 270 | |
|
271 |
if(brush == axis->labelsBrush() |
|
|
271 | if(m_force || brush == axis->labelsBrush()){ | |
|
272 | 272 | axis->setLabelsBrush(m_labelBrush); |
|
273 | 273 | } |
|
274 |
if(pen == axis->labelsPen() |
|
|
274 | if(m_force || pen == axis->labelsPen()){ | |
|
275 | 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 | 282 | axis->setShadesBrush(m_backgroundShadesBrush); |
|
283 | 283 | } |
|
284 | 284 | |
|
285 |
if(pen == axis->shadesPen() |
|
|
285 | if(m_force || pen == axis->shadesPen()){ | |
|
286 | 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 | 298 | axis->setAxisPen(m_axisLinePen); |
|
299 | 299 | } |
|
300 | 300 | |
|
301 |
if(pen == axis->gridLinePen() |
|
|
301 | if(m_force || pen == axis->gridLinePen()){ | |
|
302 | 302 | axis->setGridLinePen(m_gridLinePen); |
|
303 | 303 | } |
|
304 | 304 | |
|
305 |
if(font == axis->labelsFont() |
|
|
305 | if(m_force || font == axis->labelsFont()){ | |
|
306 | 306 | axis->setLabelsFont(m_labelFont); |
|
307 | 307 | } |
|
308 | 308 | } |
@@ -387,7 +387,7 QColor ChartTheme::colorAt(const QGradient &gradient, qreal pos) | |||
|
387 | 387 | |
|
388 | 388 | void ChartTheme::setForced(bool enabled) |
|
389 | 389 | { |
|
390 | m_force=enabled; | |
|
390 | m_force = enabled; | |
|
391 | 391 | } |
|
392 | 392 | |
|
393 | 393 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now