From e1c0cace95d6ed19dff37a524c7f4b2288d258d7 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Wed, 13 Jan 2021 16:19:27 +0100 Subject: 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 --- stats/informationbox.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'stats/informationbox.cpp') diff --git a/stats/informationbox.cpp b/stats/informationbox.cpp index c768b77b3..02fdb9e97 100644 --- a/stats/informationbox.cpp +++ b/stats/informationbox.cpp @@ -12,7 +12,8 @@ static const double informationBorderRadius = 4.0; // Radius of rounded corners static const int distanceFromPointer = 10; // Distance to place box from mouse pointer or scatter item InformationBox::InformationBox(StatsView &v) : - ChartRectItem(v, QPen(informationBorderColor, informationBorder), + ChartRectItem(v, ChartZValue::InformationBox, + QPen(informationBorderColor, informationBorder), QBrush(informationColor), informationBorderRadius) { } -- cgit v1.2.3-70-g09d2