##// END OF EJS Templates
Fix some more Cppcheck findings
Fix some more Cppcheck findings

File last commit:

r1919:91b94c58701c
r1921:e9f381914c53
Show More
charttheme.cpp
393 lines | 11.4 KiB | text/x-c | CppLexer
Jani Honkonen
Add license headers
r794 /****************************************************************************
**
** Copyright (C) 2012 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
** This file is part of the Qt Commercial Charts Add-on.
**
** $QT_BEGIN_LICENSE$
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.
**
** If you have questions regarding the use of this file, please use
** contact form at http://qt.digia.com
** $QT_END_LICENSE$
**
****************************************************************************/
Tero Ahola
Refactored themes; now enabled for line, scatter and pies...
r103 #include "charttheme_p.h"
#include "qchart.h"
Tero Ahola
Added drop shadow effect for light themes
r1001 #include "qchart_p.h"
Tero Ahola
New theme with light colors, chartview background
r584 #include "qchartview.h"
sauimone
background to legend, theme applies
r540 #include "qlegend.h"
Michal Klocek
Refactors QAxis to QAbstractAxis...
r1541 #include "qabstractaxis.h"
Jani Honkonen
Fix color generation for pie
r324 #include <QTime>
Tero Ahola
Refactored themes; now enabled for line, scatter and pies...
r103
Michal Klocek
Refactor themes...
r143 //series
sauimone
Added pen & brush to QBarSet
r214 #include "qbarset.h"
sauimone
renamed barseries files to abstractbarseries
r1586 #include "qabstractbarseries.h"
sauimone
Naming convention change for barcharts. QBarChartSeries is now QBarSeries etc.
r338 #include "qstackedbarseries.h"
#include "qpercentbarseries.h"
Michal Klocek
Rename QLineChartSeries to QLineSeries
r349 #include "qlineseries.h"
Michal Klocek
Adds area chart...
r421 #include "qareaseries.h"
Tero Ahola
Enabled theme colors in scatter again
r182 #include "qscatterseries.h"
Jani Honkonen
Make pie work better with chartwidgettest
r163 #include "qpieseries.h"
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 #include "qpieslice.h"
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 #include "qpieslice_p.h"
Marek Rosa
Spline working somewhat
r401 #include "qsplineseries.h"
Jani Honkonen
Make pie work better with chartwidgettest
r163
Michal Klocek
Refactor themes...
r143 //items
Michal Klocek
Changes QChartAxis -> QAxis
r1006 #include "chartaxis_p.h"
sauimone
refactoring internal barchart items
r1674 #include "abstractbarchartitem_p.h"
sauimone
combined barpresenterbase and barpresenter. renamed barchartpresenters to barchartitems
r666 #include "stackedbarchartitem_p.h"
#include "percentbarchartitem_p.h"
Michal Klocek
Fix previous broken commit
r145 #include "linechartitem_p.h"
Michal Klocek
Adds area chart...
r421 #include "areachartitem_p.h"
Michal Klocek
Refactor scatter chart to fit the other classes...
r470 #include "scatterchartitem_p.h"
Jani Honkonen
Rename piepresenter -> piechartitem
r568 #include "piechartitem_p.h"
Marek Rosa
Renamed SplinePresenter to SplineChartItem
r460 #include "splinechartitem_p.h"
Tero Ahola
Refactored themes; now enabled for line, scatter and pies...
r103
Michal Klocek
Refactor themes...
r143 //themes
Tero Ahola
Removed default theme, now using light as the default
r853 #include "chartthemesystem_p.h"
Tero Ahola
Three more themes
r651 #include "chartthemelight_p.h"
#include "chartthemebluecerulean_p.h"
#include "chartthemedark_p.h"
#include "chartthemebrownsand_p.h"
#include "chartthemebluencs_p.h"
Tero Ahola
Added Icy Blue and High Contrast theme
r757 #include "chartthemehighcontrast_p.h"
#include "chartthemeblueicy_p.h"
Tero Ahola
tuning theme colors
r125
Michal Klocek
Refactor themes...
r143 QTCOMMERCIALCHART_BEGIN_NAMESPACE
Tero Ahola
Fonts and background of the themes...
r614 ChartTheme::ChartTheme(QChart::ChartTheme id) :
Jani Honkonen
fix some Cppcheck findings
r1919 m_id(id),
Tero Ahola
Removed default theme, now using light as the default
r853 m_masterFont(QFont("arial", 14)),
Tero Ahola
Defined point sizes for fonts
r717 m_labelFont(QFont("arial", 10)),
Tero Ahola
Removed QLegend::setLabelPen, clean up theme label brushes
r1528 m_labelBrush(QColor(QRgb(0x000000))),
Tero Ahola
Fonts and background of the themes...
r614 m_axisLinePen(QPen(QRgb(0x000000))),
m_backgroundShadesPen(Qt::NoPen),
m_backgroundShadesBrush(Qt::NoBrush),
m_backgroundShades(BackgroundShadesNone),
Tero Ahola
Added drop shadow effect for light themes
r1001 m_backgroundDropShadowEnabled(false),
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 m_gridLinePen(QPen(QRgb(0x000000))),
m_force(false)
Michal Klocek
Refactor themes...
r143 {
Jani Honkonen
Fix color generation for pie
r324 qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
Michal Klocek
Refactor themes...
r143 }
Michal Klocek
Adds missing ids to theme classes
r153 ChartTheme* ChartTheme::createTheme(QChart::ChartTheme theme)
Michal Klocek
Refactor themes...
r143 {
switch(theme) {
Marek Rosa
BarSet label brush is no longer reset to theme default brush if it was preset earlier
r1760 case QChart::ChartThemeLight:
return new ChartThemeLight();
case QChart::ChartThemeBlueCerulean:
return new ChartThemeBlueCerulean();
case QChart::ChartThemeDark:
return new ChartThemeDark();
case QChart::ChartThemeBrownSand:
return new ChartThemeBrownSand();
case QChart::ChartThemeBlueNcs:
return new ChartThemeBlueNcs();
case QChart::ChartThemeHighContrast:
return new ChartThemeHighContrast();
case QChart::ChartThemeBlueIcy:
return new ChartThemeBlueIcy();
default:
return new ChartThemeSystem();
Michal Klocek
Refactor themes...
r143 }
}
Marek Rosa
White spaces fixes in Theme and animation classes
r948 void ChartTheme::decorate(QChart *chart)
Michal Klocek
Refactor themes...
r143 {
Michal Klocek
Adds force option to chartTheme...
r645 QBrush brush;
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if(m_force || brush == chart->backgroundBrush())
Tero Ahola
Added Icy Blue and High Contrast theme
r757 chart->setBackgroundBrush(m_chartBackgroundGradient);
Michal Klocek
Adds force option to chartTheme...
r645 chart->setTitleFont(m_masterFont);
Tero Ahola
Removed QLegend::setLabelPen, clean up theme label brushes
r1528 chart->setTitleBrush(m_labelBrush);
Tero Ahola
Minor modifications to properties of abstract, area and bar series
r1462 chart->setDropShadowEnabled(m_backgroundDropShadowEnabled);
Michal Klocek
Refactor themes...
r143 }
Marek Rosa
White spaces fixes in Theme and animation classes
r948 void ChartTheme::decorate(QLegend *legend)
sauimone
background to legend, theme applies
r540 {
Michal Klocek
Adds force option to chartTheme...
r645 QPen pen;
QBrush brush;
sauimone
legend theme fix
r1527 QFont font;
Michal Klocek
Adds force option to chartTheme...
r645
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if (m_force || pen == legend->pen())
Tero Ahola
Fixed decoration of QLegend
r1455 legend->setPen(m_axisLinePen);
Michal Klocek
Adds force option to chartTheme...
r645
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if (m_force || brush == legend->brush())
Michal Klocek
Adds force option to chartTheme...
r645 legend->setBrush(m_chartBackgroundGradient);
sauimone
legend theme fix
r1527
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if (m_force || font == legend->font())
sauimone
legend theme fix
r1527 legend->setFont(m_labelFont);
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if (m_force || brush == legend->labelBrush())
Tero Ahola
Removed QLegend::setLabelPen, clean up theme label brushes
r1528 legend->setLabelBrush(m_labelBrush);
sauimone
background to legend, theme applies
r540 }
Marek Rosa
White spaces fixes in Theme and animation classes
r948 void ChartTheme::decorate(QAreaSeries *series, int index)
Michal Klocek
Adds area chart...
r421 {
Michal Klocek
Revert "Theme change now affects also XY series"...
r644 QPen pen;
QBrush brush;
Michal Klocek
Adds area chart...
r421
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if (m_force || pen == series->pen()){
Tero Ahola
Use light outline color instead of dark for bar, area and scatter
r653 pen.setColor(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 0.0));
Michal Klocek
Revert "Theme change now affects also XY series"...
r644 pen.setWidthF(2);
series->setPen(pen);
}
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if (m_force || brush == series->brush()) {
Marek Rosa
BarSet label brush is no longer reset to theme default brush if it was preset earlier
r1760 QBrush brush(m_seriesColors.at(index % m_seriesColors.size()));
series->setBrush(brush);
Michal Klocek
Revert "Theme change now affects also XY series"...
r644 }
Michal Klocek
Adds area chart...
r421 }
Marek Rosa
White spaces fixes in Theme and animation classes
r948 void ChartTheme::decorate(QLineSeries *series,int index)
Tero Ahola
Refactored themes; now enabled for line, scatter and pies...
r103 {
Michal Klocek
Revert "Theme change now affects also XY series"...
r644 QPen pen;
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if(m_force || pen == series->pen()){
Michal Klocek
Revert "Theme change now affects also XY series"...
r644 pen.setColor(m_seriesColors.at(index%m_seriesColors.size()));
pen.setWidthF(2);
series->setPen(pen);
}
Tero Ahola
Refactored themes; now enabled for line, scatter and pies...
r103 }
sauimone
QBarSeries to QAbstractBarSeries
r1584 void ChartTheme::decorate(QAbstractBarSeries *series, int index)
Tero Ahola
One more alternative for changing themes
r108 {
Michal Klocek
Adds force option to chartTheme...
r645 QBrush brush;
Tero Ahola
Use light outline color instead of dark for bar, area and scatter
r653 QPen pen;
Marek Rosa
White spaces fixes in Theme and animation classes
r948 QList<QBarSet *> sets = series->barSets();
Michal Klocek
Adds force option to chartTheme...
r645
Tero Ahola
Bar series to use theme base colors. Pie brush minor fix....
r661 qreal takeAtPos = 0.5;
qreal step = 0.2;
if (sets.count() > 1 ) {
step = 1.0 / (qreal) sets.count();
if (sets.count() % m_seriesGradients.count())
step *= m_seriesGradients.count();
else
step *= (m_seriesGradients.count() - 1);
}
Michal Klocek
Adds force option to chartTheme...
r645
Tero Ahola
Bar series to use theme base colors. Pie brush minor fix....
r661 for (int i(0); i < sets.count(); i++) {
int colorIndex = (index + i) % m_seriesGradients.count();
if (i > 0 && i % m_seriesGradients.count() == 0) {
// There is no dedicated base color for each sets, generate more colors
takeAtPos += step;
if (takeAtPos == 1.0)
takeAtPos += step;
takeAtPos -= (int) takeAtPos;
sauimone
better use of gradients in barcharts
r512 }
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if (m_force || brush == sets.at(i)->brush())
Tero Ahola
Bar series to use theme base colors. Pie brush minor fix....
r661 sets.at(i)->setBrush(colorAt(m_seriesGradients.at(colorIndex), takeAtPos));
Tero Ahola
Refactored themes; now enabled for line, scatter and pies...
r103
Tero Ahola
Use light outline color instead of dark for bar, area and scatter
r653 // Pick label color from the opposite end of the gradient.
// 0.3 as a boundary seems to work well.
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if (m_force || brush == sets.at(i)->labelBrush()) {
Marek Rosa
BarSet label brush is no longer reset to theme default brush if it was preset earlier
r1760 if (takeAtPos < 0.3)
sets.at(i)->setLabelBrush(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 1));
else
sets.at(i)->setLabelBrush(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 0));
}
Michal Klocek
Adds force option to chartTheme...
r645
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if (m_force || pen == sets.at(i)->pen()) {
Tero Ahola
Use light outline color instead of dark for bar, area and scatter
r653 QColor c = colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 0.0);
sets.at(i)->setPen(c);
sauimone
better use of gradients in barcharts
r512 }
sauimone
integrating bar charts to test app.. crashes for now
r164 }
Michal Klocek
Refactor themes...
r143 }
Tero Ahola
Refactored themes; now enabled for line, scatter and pies...
r103
Marek Rosa
White spaces fixes in Theme and animation classes
r948 void ChartTheme::decorate(QScatterSeries *series, int index)
Tero Ahola
Enabled theme colors in scatter again
r182 {
Michal Klocek
Revert "Theme change now affects also XY series"...
r644 QPen pen;
QBrush brush;
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if (m_force || pen == series->pen()) {
Tero Ahola
Use light outline color instead of dark for bar, area and scatter
r653 pen.setColor(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 0.0));
Michal Klocek
Revert "Theme change now affects also XY series"...
r644 pen.setWidthF(2);
series->setPen(pen);
}
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if (m_force || brush == series->brush()) {
Michal Klocek
Revert "Theme change now affects also XY series"...
r644 QBrush brush(m_seriesColors.at(index % m_seriesColors.size()));
series->setBrush(brush);
}
Tero Ahola
Enabled theme colors in scatter again
r182 }
Marek Rosa
White spaces fixes in Theme and animation classes
r948 void ChartTheme::decorate(QPieSeries *series, int index)
Jani Honkonen
Make pie work better with chartwidgettest
r163 {
Jani Honkonen
Refactoring QPieSlice private implementation. Removes the useless QPieSlicePrivate layer and uses PieSliceData directly.
r818
Tero Ahola
Theme gradients now generated from a single base color
r507 for (int i(0); i < series->slices().count(); i++) {
Jani Honkonen
Fix setting custom color to pie. Now the pie knows if the color is set by the user.
r691
QColor penColor = colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 0.0);
Tero Ahola
Use light outline color instead of dark for bar, area and scatter
r653
// Get color for a slice from a gradient linearly, beginning from the start of the gradient
Tero Ahola
Bar series to use theme base colors. Pie brush minor fix....
r661 qreal pos = (qreal) (i + 1) / (qreal) series->count();
Jani Honkonen
Fix setting custom color to pie. Now the pie knows if the color is set by the user.
r691 QColor brushColor = colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), pos);
Jani Honkonen
Refactoring QPieSlice private implementation. Removes the useless QPieSlicePrivate layer and uses PieSliceData directly.
r818 QPieSlice *s = series->slices().at(i);
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 QPieSlicePrivate *d = QPieSlicePrivate::fromSlice(s);
Jani Honkonen
Fix setting custom color to pie. Now the pie knows if the color is set by the user.
r691
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if (m_force || d->m_data.m_slicePen.isThemed())
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 d->setPen(penColor, true);
Jani Honkonen
Fix setting custom color to pie. Now the pie knows if the color is set by the user.
r691
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if (m_force || d->m_data.m_sliceBrush.isThemed())
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 d->setBrush(brushColor, true);
Jani Honkonen
Get pie slice label font and pen from theme
r714
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if (m_force || d->m_data.m_labelBrush.isThemed())
Tero Ahola
Removed QLegend::setLabelPen, clean up theme label brushes
r1528 d->setLabelBrush(m_labelBrush.color(), true);
Jani Honkonen
Get pie slice label font and pen from theme
r714
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if (m_force || d->m_data.m_labelFont.isThemed())
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 d->setLabelFont(m_labelFont, true);
Jani Honkonen
Make pie work better with chartwidgettest
r163 }
}
Marek Rosa
White spaces fixes in Theme and animation classes
r948 void ChartTheme::decorate(QSplineSeries *series, int index)
Marek Rosa
Spline working somewhat
r401 {
Michal Klocek
Revert "Theme change now affects also XY series"...
r644 QPen pen;
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if(m_force || pen == series->pen()){
Michal Klocek
Revert "Theme change now affects also XY series"...
r644 pen.setColor(m_seriesColors.at(index%m_seriesColors.size()));
pen.setWidthF(2);
series->setPen(pen);
}
Marek Rosa
Spline working somewhat
r401 }
Michal Klocek
Refactors Domain and Axis...
r1698 void ChartTheme::decorate(QAbstractAxis *axis)
Tero Ahola
Added axis related modifiers to theme
r548 {
Michal Klocek
Adds force option to chartTheme...
r645 QPen pen;
QBrush brush;
QFont font;
Michal Klocek
Refactors Domain and Axis...
r1698 bool axisX = axis->orientation()== Qt::Horizontal;
Marek Rosa
QAbstractAxis: renamed Arrow and Axis to line in methods names
r1844 if (axis->isLineVisible()) {
Michal Klocek
Adds force option to chartTheme...
r645
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if(m_force || brush == axis->labelsBrush()){
Tero Ahola
Removed QLegend::setLabelPen, clean up theme label brushes
r1528 axis->setLabelsBrush(m_labelBrush);
Michal Klocek
Adds force option to chartTheme...
r645 }
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if(m_force || pen == axis->labelsPen()){
Michal Klocek
Adds force option to chartTheme...
r645 axis->setLabelsPen(Qt::NoPen); // NoPen for performance reasons
}
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if (m_force || axis->shadesVisible()) {
Michal Klocek
Adds force option to chartTheme...
r645
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if(m_force || brush == axis->shadesBrush()){
Marek Rosa
BarSet label brush is no longer reset to theme default brush if it was preset earlier
r1760 axis->setShadesBrush(m_backgroundShadesBrush);
}
Michal Klocek
Adds force option to chartTheme...
r645
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if(m_force || pen == axis->shadesPen()){
Marek Rosa
BarSet label brush is no longer reset to theme default brush if it was preset earlier
r1760 axis->setShadesPen(m_backgroundShadesPen);
}
Michal Klocek
Adds force option to chartTheme...
r645
Marek Rosa
BarSet label brush is no longer reset to theme default brush if it was preset earlier
r1760 if( m_force && (m_backgroundShades == BackgroundShadesBoth
|| (m_backgroundShades == BackgroundShadesVertical && axisX)
|| (m_backgroundShades == BackgroundShadesHorizontal && !axisX))){
axis->setShadesVisible(true);
Michal Klocek
Adds force option to chartTheme...
r645
Marek Rosa
BarSet label brush is no longer reset to theme default brush if it was preset earlier
r1760 }
}
Michal Klocek
Adds force option to chartTheme...
r645
Marek Rosa
QAbstractAxis: renamed Arrow and Axis to line in methods names
r1844 if(m_force || pen == axis->linePen()){
axis->setLinePen(m_axisLinePen);
Michal Klocek
Adds force option to chartTheme...
r645 }
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if(m_force || pen == axis->gridLinePen()){
Michal Klocek
Adds force option to chartTheme...
r645 axis->setGridLinePen(m_gridLinePen);
}
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if(m_force || font == axis->labelsFont()){
Tero Ahola
Defined point sizes for fonts
r717 axis->setLabelsFont(m_labelFont);
Tero Ahola
Added axis related modifiers to theme
r548 }
}
}
Tero Ahola
Theme gradients now generated from a single base color
r507 void ChartTheme::generateSeriesGradients()
{
// Generate gradients in HSV color space
Michal Klocek
Krazy reported errors...
r974 foreach (const QColor& color, m_seriesColors) {
Tero Ahola
Theme gradients now generated from a single base color
r507 QLinearGradient g;
qreal h = color.hsvHueF();
qreal s = color.hsvSaturationF();
// TODO: tune the algorithm to give nice results with most base colors defined in
// most themes. The rest of the gradients we can define manually in theme specific
// implementation.
QColor start = color;
Tero Ahola
Use pure white in the light end of gradients
r656 start.setHsvF(h, 0.0, 1.0);
Tero Ahola
Theme gradients now generated from a single base color
r507 g.setColorAt(0.0, start);
g.setColorAt(0.5, color);
QColor end = color;
end.setHsvF(h, s, 0.25);
g.setColorAt(1.0, end);
m_seriesGradients << g;
}
}
Jani Honkonen
Adding list of series gradients to theme.
r494 QColor ChartTheme::colorAt(const QColor &start, const QColor &end, qreal pos)
{
Marek Rosa
White spaces fixes in Theme and animation classes
r948 Q_ASSERT(pos >= 0.0 && pos <= 1.0);
Jani Honkonen
Adding list of series gradients to theme.
r494 qreal r = start.redF() + ((end.redF() - start.redF()) * pos);
qreal g = start.greenF() + ((end.greenF() - start.greenF()) * pos);
qreal b = start.blueF() + ((end.blueF() - start.blueF()) * pos);
QColor c;
c.setRgbF(r, g, b);
return c;
}
QColor ChartTheme::colorAt(const QGradient &gradient, qreal pos)
{
Marek Rosa
White spaces fixes in Theme and animation classes
r948 Q_ASSERT(pos >= 0 && pos <= 1.0);
Jani Honkonen
Adding list of series gradients to theme.
r494
QGradientStops stops = gradient.stops();
int count = stops.count();
// find previous stop relative to position
QGradientStop prev = stops.first();
Marek Rosa
White spaces fixes in Theme and animation classes
r948 for (int i = 0; i < count; i++) {
Jani Honkonen
Adding list of series gradients to theme.
r494 QGradientStop stop = stops.at(i);
if (pos > stop.first)
prev = stop;
// given position is actually a stop position?
if (pos == stop.first) {
//qDebug() << "stop color" << pos;
return stop.second;
}
}
// find next stop relative to position
QGradientStop next = stops.last();
Marek Rosa
White spaces fixes in Theme and animation classes
r948 for (int i = count - 1; i >= 0; i--) {
Jani Honkonen
Adding list of series gradients to theme.
r494 QGradientStop stop = stops.at(i);
if (pos < stop.first)
next = stop;
}
//qDebug() << "prev" << prev.first << "pos" << pos << "next" << next.first;
qreal range = next.first - prev.first;
qreal posDelta = pos - prev.first;
qreal relativePos = posDelta / range;
//qDebug() << "range" << range << "posDelta" << posDelta << "relativePos" << relativePos;
return colorAt(prev.second, next.second, relativePos);
}
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 void ChartTheme::setForced(bool enabled)
{
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 m_force = enabled;
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 }
Tero Ahola
Refactored themes; now enabled for line, scatter and pies...
r103 QTCOMMERCIALCHART_END_NAMESPACE