From 5b6f4685475be7f7b68375fcab465c1626950296 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 6 Feb 2021 12:26:54 +0100 Subject: statistics: don't place labels at half-integer values Placing labels at half-integer values gives horrible rendering artifacts. Therefore, always round to integer values. The easiest way to do this is right before setting the position. Introduce a helper function to round QPointF in such scenarios. Signed-off-by: Berthold Stoeger --- stats/statshelper.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'stats/statshelper.h') diff --git a/stats/statshelper.h b/stats/statshelper.h index 6b4a30ab5..45d58d022 100644 --- a/stats/statshelper.h +++ b/stats/statshelper.h @@ -1,12 +1,16 @@ // SPDX-License-Identifier: GPL-2.0 -// Helper functions to render the stats. Currently contains +// Helper functions to render the stats. Includes // QSGNode template jugglery to overcome API flaws. #ifndef STATSHELPER_H #define STATSHELPER_H #include +#include #include +// Round positions to integer values to avoid ugly artifacts +QPointF roundPos(const QPointF &p); + // A stupid pointer class that initializes to null and can be copy // assigned. This is for historical reasons: unique_ptrs to ChartItems // were replaced by plain pointers. Instead of nulling the plain pointers -- cgit v1.2.3-70-g09d2