From 8661823c977d176f38923e9db01962aa1f6f4743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Sommer?= Date: Tue, 7 Nov 2017 15:18:15 +0100 Subject: [PATCH] paytoedit: Calculate height depending on font's line height On high-resolution (HiRes) displays, the pixel size of a font is much larger than the hard-coded 17 pixels, e.g. more than 40 for me. It's better to get the line high of the current font from it's metrics and calculate the high of the box with it. --- gui/qt/paytoedit.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gui/qt/paytoedit.py b/gui/qt/paytoedit.py index 0151e0f3..83881e79 100644 --- a/gui/qt/paytoedit.py +++ b/gui/qt/paytoedit.py @@ -186,8 +186,9 @@ class PayToEdit(ScanQRTextEdit): self.update_size() def update_size(self): + lineHeight = QFontMetrics(self.document().defaultFont()).height() docHeight = self.document().size().height() - h = docHeight*17 + 11 + h = docHeight * lineHeight + 11 if self.heightMin <= h <= self.heightMax: self.setMinimumHeight(h) self.setMaximumHeight(h)