User-provided stylesheet (patch; KdeUiProxyStyle problem)

David Faure faure at kde.org
Mon Jan 28 14:48:24 GMT 2008


During the KDE4 release-party/conference in Toulouse, Aurélien Gateau was demo'ing
the use of CSS stylesheets in Qt, and someone asked whether it was possible for a
user to set a global stylesheet to be used by all KDE applications.
This seems like a very good idea indeed, for easy-to-write widget "themes", 
and for accessibility purposes as well.

During the next talk and afterwards I hacked it up and it works sort of fine...
(good enough for a demo a few hours later, to make the audience go "wow" ;)

The patch adds the GUI (KUrlRequester) for a user-specified stylesheet in `kcmshell4 style`, 
the KGlobalSettings code for using it, including honouring the --stylesheet argument so that
this one has priority over the kde-global stylesheet [you can ignore the kcmdlineargs.cpp patch
for trunk, which already has that line]. The apply button propagates the setting
to all running kde applications, much like when changing widget styles.

There are 3 problems with this feature though.

The main problem is that any code using a proxy style like KdeUiProxyStyle (KLineEdit)
and KonqProxyStyle (konqueror) crashes due to infinite recursion, the proxy style
calls the real style, which is in fact the stylesheet-style, which calls the "base" style
which is the kdeuiproxystyle, etc. I don't have a solution for this; this mail is about
getting the other patches out in the open in case someone's interested, and for
when the proxy-style issue is fixed :)

Another problem is that stylesheets usually refer to images, which are found in the "current working directory",
but that solution doesn't work for applications with random working directories. It seems to me
that we need a setStyleSheetDirectory() in QApplication and QWidget? Or what do I miss?

This feature triggers another bug: konsole switches to a proportional font when pressing the apply
button in kcmshell4 style; this is again because of Qt's wrong logic of "when you use a stylesheet,
the widget font is completely ignored", which still makes no sense to me even though it's documented
that way. This is the same problem as the one which made use switch to a proxy style for klineedit iirc,
is supposed to be fixed by Qt-4.4?

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdebase_kcmstyle.diff
Type: text/x-diff
Size: 7088 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080128/d73fbf78/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdelibs_global_stylesheet.diff
Type: text/x-diff
Size: 3564 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080128/d73fbf78/attachment-0001.diff>


More information about the kde-core-devel mailing list