Fwd (OSX guys take note): KStyle::defaultStyle() related
Mark Kretschmann
kretschmann at kde.org
Wed Nov 26 09:29:06 CET 2008
I figured this thread might be interesting to lfranchi and orville,
who were having issues with Oxygen being the default style on OSX:
---------- Forwarded message ----------
From: Ralf Habacker <ralf.habacker at freenet.de>
Date: Tue, Nov 25, 2008 at 11:02 AM
Subject: KStyle::defaultStyle() related
To: kde-core-devel at kde.org, Jarosław Staniek <js at iidea.pl>
Hi,
in kdelibs/kdeui/kernel/kglobalsettings.cpp there is the following code snippet
void KGlobalSettings::Private::applyGUIStyle()
{
const QLatin1String
currentStyleName(qApp->style()->metaObject()->className());
if (kde_overrideStyle.isEmpty()) {
#ifdef Q_WS_X11
const QString &defaultStyle = KStyle::defaultStyle();
#else
const QString defaultStyle; // Mac, Windows: no change for style
by default
#endif
const KConfigGroup pConfig(KGlobal::config(), "General");
const QString &styleStr = pConfig.readEntry("widgetStyle", defaultStyle);
...
This code seems to me a special hack for non x11 platforms to be able
to use a "native" default style, which is not supported by the recent
implementation of KStyle:defaultStyle(), which is hardcoded to
"oxygen". Would it not make the code clearer to extend
KStyle::defaultStyle() with the platform related native style like
shown below ?
QString KStyle::defaultStyle()
{
#ifndef Q_WS_X11
return QString(""); // native
#else
return QString("oxygen");
#endif
}
Then the first code snippet above could be eased to
void KGlobalSettings::Private::applyGUIStyle()
{
const QLatin1String
currentStyleName(qApp->style()->metaObject()->className());
if (kde_overrideStyle.isEmpty()) {
const QString &defaultStyle = KStyle::defaultStyle();
const KConfigGroup pConfig(KGlobal::config(), "General");
const QString &styleStr = pConfig.readEntry("widgetStyle", defaultStyle);
...
I would apply the required changes to trunk and other branches if
required if there are no objections
Regards
Ralf
--
Mark Kretschmann
Amarok Developer
www.kde.org - amarok.kde.org
More information about the Amarok-devel
mailing list