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 <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-02-06 12:26:54 +01:00 committed by Dirk Hohndel
parent f1203d365a
commit 5b6f468547
7 changed files with 31 additions and 12 deletions

10
stats/statshelper.cpp Normal file
View file

@ -0,0 +1,10 @@
// SPDX-License-Identifier: GPL-2.0
#include "statshelper.h"
#include <cmath>
QPointF roundPos(const QPointF &p)
{
return QPointF(round(p.x()), round(p.y()));
}