[Development] platform theme plugins and automatically loading them
René J.V. Bertin
rjvbertin at gmail.com
Thu Jan 19 11:55:25 CET 2017
You probably remember that I have been tinkering with an auto-loading Qt platform theme plugin for Mac, an adapted version of the KDE platform theme plugin from "Plasma Integration". The goal is to provide support for KDE's colour & icon palettes plus font role definitions (from kdeglobals) which can then be used with any application style including the native macintosh style. This makes KF5 applications look a lot more how they are designed to look.
The set-up is simple:
- QCocoaIntegration::themeNames() returns an additional theme name, "kde"
- the build system is patched so that qgenericunixservices and qgenericunixthemes are built and included, so a "kde" theme is defined at that level
- the platform theme plugin declares a org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1 key "kde".
- the platform theme plugin main class has a proxy to the native theme, created as
nativeTheme = QGuiApplicationPrivate::platformIntegration()->createPlatformTheme(QGuiApplication::platformName());
That proxy is used whenever the theme plugin doesn't completely override the native theme choice.
I'm not really sure exactly why, but this works, nor to what extent QGenericUnixThemes are required (I've tried following the execution flow but the lldb debugger tends to get stuck).
1. Does the platform theme plugin have to be called "kde", i.e. have the same name as the internal "kde" theme? IOW, are platform theme plugins matched to existing internal plugins themes (to extend them), or are they "plugins that provide additional platform themes"? In yet other words, can I call the platform theme plugin "cocoa" and leave out the internal QKdeTheme?
2. Has anything changed in the related functionality between Qt 5.7.1 and Qt 5.8.0? I'm currently testing 5.8.0RC installed into a "destroot" (make install INSTALL_ROOT=foo) using DYLD_FRAMEWORK_PATH and QT_PLUGIN_PATH set appropriately. Existing apps run fine and even use my installed application styles, but apparently NOT the platform theme plugin. I thus get the KDE look and feel, but all platform integration is lost that is normally provided through the native theme proxy. My platform theme binary is loaded from what I can tell, but its entry point isn't called. Is that to be expected?
More information about the Development