From 9d0a71d7e514cb4a11649464e8e867b2ce39e106 Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Mon, 2 May 2022 14:41:05 -0600 Subject: [PATCH] kcms/fonts: show warning when user tries to set a non-integer font size It triggers https://bugreports.qt.io/browse/QTBUG-92006, and we need to warn users about that. CCBUG: 432372 --- kcms/fonts/package/contents/ui/main.qml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/kcms/fonts/package/contents/ui/main.qml b/kcms/fonts/package/contents/ui/main.qml index 152ca2d40..bd2c9869b 100644 --- a/kcms/fonts/package/contents/ui/main.qml +++ b/kcms/fonts/package/contents/ui/main.qml @@ -64,6 +64,29 @@ KCM.SimpleKCM { actions: [ kscreenAction ] } + Kirigami.InlineMessage { + id: fractionalFontSizeWarning + Layout.fillWidth: true + showCloseButton: true + type: Kirigami.MessageType.Warning + text: i18n("Decimal font sizes can cause text layout problems in some applications. Consider using only integer font sizes.") + // Specifically, it will trigger https://bugreports.qt.io/browse/QTBUG-92006, + // but we don't mention that in the message because that would be too technical + // for users. + + Connections { + target: kcm + function onFontsHaveChanged() { + fractionalFontSizeWarning.visible = + !Number.isInteger(generalFontWidget.font.pointSize) + || !Number.isInteger(fixedWidthFontWidget.font.pointSize) + || !Number.isInteger(smallFontWidget.font.pointSize) + || !Number.isInteger(toolbarFontWidget.font.pointSize) + || !Number.isInteger(menuFontWidget.font.pointSize) + } + } + } + Kirigami.InlineMessage { id: dpiTwiddledMessage Layout.fillWidth: true