The font used by Qt4 applications is always set to sans-serif 9pt, no matter what I select in system settings. Even if I set the font with qtconfig-qt4, it is reset on login.
Steps to Reproduce:
1) In system settings, set system font to MSYH 10pt (for example).
2) Open a Qt4 application such as VLC. The font used is sans-serif 9pt.
3) In qtconfig-qt4, set font to MSYH 10pt.
4) Open the Qt4 application. The font used is MSYH 10pt.
5) Logout and login. Open the Qt4 application. The font used is again sans-serif 9pt.
Qt4 applications use sans-serif 9pt at 2) and 5).
Qt4 applications use MSYH 10pt, as configured in system settings.
The config file that Qt4 applications use is ~/.config/Trolltech.conf. On login, kcminit (kcminit style) writes KDE5 settings to this file. In plasma-desktop/kcms/krdb/krdb.cpp, function applyQtSettings:
Qt's default font is written to Trolltech.conf, which is supposed to be the font set in system settings on KDE5. However, this is launched by kcminit, which has plasma-workspace/startkde/kcminit/main.cpp, function kdemain:
QGuiApplication app(argc, argv);
Without desktopSettingsAware, Qt's default font is forced to be sans-serif 9pt, which is then written to Trolltech.conf and causes this bug.
Suggested fix: use KDE config to get the font instead of QFontDatabase::systemFont.
--- a/krdb.cpp 2017-03-21 22:00:06.000000000 +0800
+++ b/krdb.cpp 2017-03-30 15:44:20.103183732 +0800
@@ -178,10 +178,13 @@
static void applyQtSettings( KSharedConfigPtr kglobalcfg, QSettings& settings )
/* export font settings */
- settings.setValue(QStringLiteral("/qt/font"), QFontDatabase::systemFont(QFontDatabase::GeneralFont).toString());
+ KConfigGroup kdeCfgGroup(kglobalcfg, "General");
+ QString font = kdeCfgGroup.readEntry("font", QString());
+ settings.setValue(QStringLiteral("/qt/font"), !font.isEmpty() ? font :
/* export effects settings */
- KConfigGroup kdeCfgGroup(kglobalcfg, "General");
bool effectsEnabled = kdeCfgGroup.readEntry("EffectsEnabled", false);
bool fadeMenus = kdeCfgGroup.readEntry("EffectFadeMenu", false);
bool fadeTooltips = kdeCfgGroup.readEntry("EffectFadeTooltip", false);
Or remove that QGuiApplication::setDesktopSettingsAware(false).
A similar report: https://forum.kde.org/viewtopic.php?f=289&t=139158
Do you have the kde4 platform plugin installed (from kde-workspace-4.x)? I suspect that may be required (desirable?) to make this work better too.
(In reply to Rex Dieter from comment #2)
> Do you have the kde4 platform plugin installed (from kde-workspace-4.x)? I
> suspect that may be required (desirable?) to make this work better too.
I can't find this package in Arch repo. KDE4 applications have right fonts, the problem is with other Qt4 applications like vlc-qt4.
It's a Qt4 platform plugin, it's purpose is to provide a better uniform experience for Qt4-only apps. (Similar to what plasma-integration provides for pure Qt5 applications).
(In reply to Rex Dieter from comment #4)
> It's a Qt4 platform plugin, it's purpose is to provide a better uniform
> experience for Qt4-only apps. (Similar to what plasma-integration provides
> for pure Qt5 applications).
I searched the Arch repo but still cannot find it. I tried installing a rpm found on the Internet, which contains /usr/lib64/kde4/plugins/gui_platform/libkde.so, but nothing changes. Could you please list the file names/paths provided by this plugin package?
libkde.so is it
I can confirm this bug on Gentoo earlier and recently also on Fedora 25 (observed during update of kf5-5.32 to 5.33 and plasma-5.8.6 to 5.9.4)
KDE4 plarform plugin is of course installed
[mrozowsk@cnu420dqzs ~]$ rpm -ql kde-platform-plugin
When straced, pure Qt4 apps do load that plugin so QT4 plugin path is also set correctly.
Same here on openSUSE with the latest Qt5, KF5 and Plasma.
KDE4 applications do use the font from KDE4's kdeglobals (which is correctly synced), but plain Qt4 applications use the font specified in Trolltech.conf (which gets set to "Sans Serif 9" on every login to Plasma5).
Same here on KDE Neon 5.10.
Git commit 978700d9b65b6118e93a87bc7fbe9c113ca7d2ab by Kai Uwe Broulik.
Committed on 30/06/2017 at 12:16.
Pushed by broulik into branch 'master'.
[KRDB] Read kdeglobals font and fallback to hardcoded default if neccessary
kcminit is non-desktopSettingsAware (for performance) which will keep it from loading
our platform theme. This also means that QFontDatabase also won't know our font settings.
Based on a patch by jingyu9575, thanks.
M +13 -2 kcms/krdb/krdb.cpp
When is it planed to go to kdeneon?
Still not in KDE-Neon ;(
This is master branch ie. Plasma 5.11 material
Oh... ok. Thanks for the information.