From ff3f02fb8c26b3fdaa59bf04d2854a48f85cb2ab Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Wed, 9 Jan 2019 19:26:02 +0100 Subject: [PATCH] Improve highdpi support. --- app/qml/PreprocessedTerminal.qml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/qml/PreprocessedTerminal.qml b/app/qml/PreprocessedTerminal.qml index b8d61e4..d0d9cee 100644 --- a/app/qml/PreprocessedTerminal.qml +++ b/app/qml/PreprocessedTerminal.qml @@ -71,12 +71,23 @@ Item{ QMLTermWidget { id: kterminal + property int textureResolutionScale: appSettings.lowResolutionFont ? devicePixelRatio : 1 property int margin: appSettings.margin / screenScaling property int totalWidth: Math.floor(parent.width / (screenScaling * fontWidth)) property int totalHeight: Math.floor(parent.height / screenScaling) - width: totalWidth - 2 * margin - height: totalHeight - 2 * margin + property int rawWidth: totalWidth - 2 * margin + property int rawHeight: totalHeight - 2 * margin + + textureSize: Qt.size(width / textureResolutionScale, height / textureResolutionScale) + + width: ensureMultiple(rawWidth, devicePixelRatio) + height: ensureMultiple(rawHeight, devicePixelRatio) + + /** Ensure size is a multiple of factor. This is needed for pixel perfect scaling on highdpi screens. */ + function ensureMultiple(size, factor) { + return Math.round(size / factor) * factor; + } colorScheme: "cool-retro-term"