From 2418d3b95bb847db62e2b5e748fc9fc0f9efc876 Mon Sep 17 00:00:00 2001 From: Michel Dagenais Date: Wed, 10 Jun 2020 17:24:53 -0400 Subject: [PATCH] Convert size from pixels to points for use in setPointSize (#3452) Currently, size is computed from the QWidget geometry height in pixels and then used to set the font size in points. In many cases the result is not that bad because, depending on the screen size and resolution, the pizel size is not that far from one point. We now convert from pixels to inch (DPI) and then from inches to points (72 points/inch). This solves the problem of the text being clipped sometimes or the margin being too large. --- src/Train/DialWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Train/DialWindow.cpp b/src/Train/DialWindow.cpp index 62d1119dd..e75edba85 100644 --- a/src/Train/DialWindow.cpp +++ b/src/Train/DialWindow.cpp @@ -542,7 +542,7 @@ void DialWindow::resizeEvent(QResizeEvent * ) } else { // set point size within reasonable limits for low dpi screens - int size = geometry().height()-24; + int size = (geometry().height() - 24) * 72 / logicalDpiY(); if (size <= 0) size = 4; if (size >= 64) size = 64;