aboutsummaryrefslogtreecommitdiffstats
path: root/stats/legend.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-01-13 16:19:27 +0100
committerGravatar bstoeger <32835590+bstoeger@users.noreply.github.com>2021-01-20 08:47:18 +0100
commite1c0cace95d6ed19dff37a524c7f4b2288d258d7 (patch)
tree403215ac791cf0ae6eda52007c1a5feedd0b844d /stats/legend.cpp
parent785d5189f617bab7d5dde668563fc4889e46f695 (diff)
downloadsubsurface-e1c0cace95d6ed19dff37a524c7f4b2288d258d7.tar.gz
statistics: add notion of Z-value to chart items
The chart items were drawn in order of creation. To control this, add a notion of Z-value. In contrast to QGraphicsScene, make this a small integer value. To controll order of drawing, a plain QSGNode is created for every possible Z-Value and items are added to these nodes. Thus, items are rendered by Z-value and if the Z-value is equal by order of creation. Likewise split the list of chart-items into Z-values, so that items can be quickly unregistered: The items that will be removed individually will usuall be part of Z-levels with only few items (e.g. legend, infobox). Z-levels with many items (notably the series) will always be fully rebuilt. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'stats/legend.cpp')
-rw-r--r--stats/legend.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/stats/legend.cpp b/stats/legend.cpp
index 2cbd883db..590de21b0 100644
--- a/stats/legend.cpp
+++ b/stats/legend.cpp
@@ -15,7 +15,8 @@ static const QColor legendColor(0x00, 0x8e, 0xcc, 192); // Note: fourth argument
static const QColor legendBorderColor(Qt::black);
Legend::Legend(StatsView &view, const std::vector<QString> &names) :
- ChartRectItem(view, QPen(legendBorderColor, legendBorderSize), QBrush(legendColor), legendBoxBorderRadius),
+ ChartRectItem(view, ChartZValue::Legend,
+ QPen(legendBorderColor, legendBorderSize), QBrush(legendColor), legendBoxBorderRadius),
displayedItems(0), width(0.0), height(0.0),
font(QFont()) // Make configurable
{