summaryrefslogtreecommitdiffstats
path: root/src/platformsupport
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2019-04-29 22:45:14 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2019-05-07 07:48:43 +0000
commit6afdbfdaafcc4d24e08357dfea96b85787efb1f7 (patch)
treef75fc26e4dff8d035f3c285daf5d8cd5dafd8044 /src/platformsupport
parentc57520e491f420dc83d44ce5382c403192ce4836 (diff)
Use "monospace" as fallback system FixedFont in KDE theme; logging
Also de-duplicate the "monospace" string in qgenericunixthemes.cpp, and add tst_QFontDatabase::systemFixedFont() to verify that QFontDatabase::systemFont(QFontDatabase::FixedFont) really returns a monospace font across platforms. Replace commented-out qDebug()s with qt.text.font.match and qt.text.font.db logging categories to troubleshoot when the test fails (among other uses). Add qt.qpa.fonts logging category to unix themes to show default system and fixed fonts (font engines on other platforms are already using this category). Fixes: QTBUG-54623 Change-Id: I2aa62b8c783d9ddb591a5e06e8df85c4af5bcb0c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/platformsupport')
-rw-r--r--src/platformsupport/themes/genericunix/qgenericunixthemes.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
index 1003812767..6db25a90da 100644
--- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
+++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
@@ -76,6 +76,7 @@
QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(qLcTray)
+Q_LOGGING_CATEGORY(lcQpaFonts, "qt.qpa.fonts")
ResourceHelper::ResourceHelper()
{
@@ -96,6 +97,7 @@ const char *QGenericUnixTheme::name = "generic";
// Default system font, corresponding to the value returned by 4.8 for
// XRender/FontConfig which we can now assume as default.
static const char defaultSystemFontNameC[] = "Sans Serif";
+static const char defaultFixedFontNameC[] = "monospace";
enum { defaultSystemFontSize = 9 };
#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
@@ -136,9 +138,10 @@ public:
QGenericUnixThemePrivate()
: QPlatformThemePrivate()
, systemFont(QLatin1String(defaultSystemFontNameC), defaultSystemFontSize)
- , fixedFont(QStringLiteral("monospace"), systemFont.pointSize())
+ , fixedFont(QLatin1String(defaultFixedFontNameC), systemFont.pointSize())
{
fixedFont.setStyleHint(QFont::TypeWriter);
+ qCDebug(lcQpaFonts) << "default fonts: system" << systemFont << "fixed" << fixedFont;
}
const QFont systemFont;
@@ -390,7 +393,7 @@ void QKdeThemePrivate::refresh()
if (QFont *fixedFont = kdeFont(readKdeSetting(QStringLiteral("fixed"), kdeDirs, kdeVersion, kdeSettings))) {
resources.fonts[QPlatformTheme::FixedFont] = fixedFont;
} else {
- fixedFont = new QFont(QLatin1String(defaultSystemFontNameC), defaultSystemFontSize);
+ fixedFont = new QFont(QLatin1String(defaultFixedFontNameC), defaultSystemFontSize);
fixedFont->setStyleHint(QFont::TypeWriter);
resources.fonts[QPlatformTheme::FixedFont] = fixedFont;
}
@@ -403,6 +406,8 @@ void QKdeThemePrivate::refresh()
if (QFont *toolBarFont = kdeFont(readKdeSetting(QStringLiteral("toolBarFont"), kdeDirs, kdeVersion, kdeSettings)))
resources.fonts[QPlatformTheme::ToolButtonFont] = toolBarFont;
+ qCDebug(lcQpaFonts) << "default fonts: system" << resources.fonts[QPlatformTheme::SystemFont]
+ << "fixed" << resources.fonts[QPlatformTheme::FixedFont];
qDeleteAll(kdeSettings);
}
@@ -716,8 +721,9 @@ public:
QString fontName = gtkFontName.left(split);
systemFont = new QFont(fontName, size);
- fixedFont = new QFont(QLatin1String("monospace"), systemFont->pointSize());
+ fixedFont = new QFont(QLatin1String(defaultFixedFontNameC), systemFont->pointSize());
fixedFont->setStyleHint(QFont::TypeWriter);
+ qCDebug(lcQpaFonts) << "default fonts: system" << systemFont << "fixed" << fixedFont;
}
mutable QFont *systemFont;