[Development] setting default widgetStyle (and ColorScheme)

René J.V. Bertin rjvbertin at gmail.com
Fri Nov 27 23:39:07 CET 2015

Digging through Qt's source code to figure out if and how I can get KF5 applications to honour theming settings on OS X, I observe the following in class QKdeThemePrivate in qgenericunixthemes.cpp:

    static QString kdeGlobals(const QString &kdeDir)
        return kdeDir + QStringLiteral("/share/config/kdeglobals");

and QVariant QKdeThemePrivate::readKdeSetting() then does

    foreach (const QString &kdeDir, kdeDirs) {
        QSettings *settings = kdeSettings.value(kdeDir);
        if (!settings) {
            const QString kdeGlobalsPath = kdeGlobals(kdeDir);
            if (QFileInfo(kdeGlobalsPath).isReadable()) {
            // ... etc ...

It may be intentional that that file avoids the use of QStandardPaths (is it?), but it seems that this code cannot read the kdeglobals file in its intended location (~/.config/kdeglobals on XDG-compliant systems). Not even when $KDExxx variables are set to provide the correct value for `kdeDirs` .

Am I right that kdeGlobals() should return the current value only if kdeVersion<=4, and for kdeVersion>=5 it should rather return `kdeDir + QStringLiteral("/kdeglobals")`, with `kdeDirs` extended to include ~/.config? In that case, should a fallback for "/share/config/kdeglobals" be added?

A pure KF5 system will not have ~/.kde*/share/config/kdeglobals, correct?


More information about the Development mailing list