From 3eaaf59319c4cd8225b29903bda2a8bcaefc7c67 Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 27 Aug 2020 13:19:21 +0100 Subject: [PATCH] Prefer floor rounding for Qt 5.14+ fractional DPI handling * Non-integer DPI handling is fundamentally a broken concept, because UIs are essentially pixel art with some vector drawing. Rounding down half fractions seems to be a better tradeoff than rounding up or trying to render them as-is. --- qrenderdoc/Code/qrenderdoc.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/qrenderdoc/Code/qrenderdoc.cpp b/qrenderdoc/Code/qrenderdoc.cpp index 8249b6a7e..76d97bacc 100644 --- a/qrenderdoc/Code/qrenderdoc.cpp +++ b/qrenderdoc/Code/qrenderdoc.cpp @@ -94,6 +94,11 @@ int main(int argc, char *argv[]) QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); +#if(QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) + QGuiApplication::setHighDpiScaleFactorRoundingPolicy( + Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor); +#endif + QApplication::setApplicationVersion(lit(FULL_VERSION_STRING)); // shortcut here so we can run this with a non-GUI application