From 3b26f6a767595012bfe561f790404719f8580746 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 2 Jan 2021 10:25:04 +0100 Subject: statistics: add a header file defining z-values z-values determine the order in which objects on the chart are painted. To reduce chaos, collect all z-values in a header file. Signed-off-by: Berthold Stoeger --- stats/legend.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'stats/legend.cpp') diff --git a/stats/legend.cpp b/stats/legend.cpp index b532f483f..7418df9df 100644 --- a/stats/legend.cpp +++ b/stats/legend.cpp @@ -1,6 +1,8 @@ // SPDX-License-Identifier: GPL-2.0 #include "legend.h" #include "statscolors.h" +#include "zvalues.h" + #include #include #include @@ -16,7 +18,7 @@ static const QColor legendBorderColor(Qt::black); Legend::Legend(QGraphicsWidget *chart, const std::vector &names) : QGraphicsRectItem(chart), chart(chart), displayedItems(0), width(0.0), height(0.0) { - setZValue(30.0); // On top of everything else. + setZValue(ZValues::legend); entries.reserve(names.size()); int idx = 0; for (const QString &name: names) @@ -42,10 +44,10 @@ Legend::Entry::Entry(const QString &name, int idx, int numBins, QGraphicsItem *p rect(new QGraphicsRectItem(parent)), text(new QGraphicsSimpleTextItem(name, parent)) { - rect->setZValue(30.0); + rect->setZValue(ZValues::legend); rect->setPen(QPen(legendBorderColor, legendBoxBorderSize)); rect->setBrush(QBrush(binColor(idx, numBins))); - text->setZValue(30.0); + text->setZValue(ZValues::legend); text->setBrush(QBrush(darkLabelColor)); } -- cgit v1.2.3-70-g09d2