diff options
author | Sami Varanka <sami.varanka@qt.io> | 2021-09-29 14:53:35 +0300 |
---|---|---|
committer | Sami Varanka <sami.varanka@qt.io> | 2021-10-08 13:47:25 +0300 |
commit | 6d31e42632f0779212b2a265f3c9a7c97a0e63b0 (patch) | |
tree | aa59e7a7d845c8f5bb44f5690b8c08764975736a /src/datavisualization/engine/bars3drenderer.cpp | |
parent | 9f9d5bc9d45ea99726cc23b5552cce19918771b9 (diff) |
Add row colors for Bar3DSeries
Added rowColors property for Bar3DSeries.
The property can be used draw the individual
rows in the series in different colors.
Autotests and a manualtest for the property were
added also.
Fixes: QTBUG-96682
Change-Id: I5c4f778189d079206500a9289490792584eab2b9
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/datavisualization/engine/bars3drenderer.cpp')
-rw-r--r-- | src/datavisualization/engine/bars3drenderer.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/datavisualization/engine/bars3drenderer.cpp b/src/datavisualization/engine/bars3drenderer.cpp index 0c51d187..a0c58b45 100644 --- a/src/datavisualization/engine/bars3drenderer.cpp +++ b/src/datavisualization/engine/bars3drenderer.cpp @@ -1628,10 +1628,17 @@ bool Bars3DRenderer::drawBars(BarRenderItem **selectedBar, } case Bars3DController::SelectionNone: { // Current bar is not selected, nor on a row or column - if (colorStyleIsUniform) - barColor = baseColor; - else + if (colorStyleIsUniform) { + QList<QColor> rowColors = cache->series()->rowColors(); + if (rowColors.size() == 0) { + barColor = baseColor; + } else { + int rowColorIndex = row % rowColors.size(); + barColor = Utils::vectorFromColor(rowColors[rowColorIndex]); + } + } else { gradientTexture = cache->baseGradientTexture(); + } break; } } |