Make KStyle honour KDE wide single-click behaviour

David Faure faure at kde.org
Thu Jun 12 19:18:27 BST 2008


On Wednesday 11 June 2008, Andreas Pakulat wrote:
> The style hint is asked each time you release the mouse on an itemview,
> by the Qt implementation (and also double-click release). 
> 
> The creation of the kcomponent data is just allocating 1 dpointer with
> some text data (kaboutdata) and in worst case registering the component
> as main component if this is called from a non-kde-app. However that
> part can easily be cached.

I see no reason why the kcomponentdata couldn't be a member of the style,
just like it is in any other "component".
The only reason against it would be if the style could be created before
the kapplication or whichever kcomponentdata is meant to be the global
one in a kde application that doesn't use kapplication (e.g. unit tests),
but I can't see how this would happen......
Hmm, except in a qt-only app with optional kde support; when the
"kde support" code is activated (e.g. opening a file dialog), the widget style
will have been created for a long time already, and it could be a kstyle.
If it comes to that, I guess we could add a KGlobal::setMainComponentData()
to make a componentdata the global one by force...

> The singleClick() I'm not so sure about, it reads a value from
> kdeglobals. So after the first run (if kdeglobals need to be parsed) it
> should be pretty fast I think.

Yes, but if the componentdata is destroyed every time, then its KConfig object
too, which means that kdeglobals would have to be reparsed at every call
(and kstandarddirs has quite some initialization too iirc).

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list