Make KStyle honour KDE wide single-click behaviour

Andreas Pakulat apaku at gmx.de
Wed Jun 11 09:34:32 BST 2008


On 11.06.08 01:00:59, Ingo Klöcker wrote:
> On Wednesday 11 June 2008, Andreas Pakulat wrote:
> > On 11.06.08 00:34:29, Andreas Pakulat wrote:
> > > On 10.06.08 23:44:37, Andreas Pakulat wrote:
> > > > as I'm not sure its allowed for KDE styles (due to being loadable
> > > > inside plain Qt apps) to use KGlobalSettings I'm posting for
> > > > review.
> > > >
> > > > The attached patches makes KStyle provide the proper styleHint()
> > > > for QStyle::SH_ItemView_ActivateItemOnSingleClick, which means
> > > > reading the KDE wide setting for single vs. double click and
> > > > returning that. I consider this a bugfix as currently any
> > > > itemview emits the activated() signal only when double-clicking
> > > > items - on all platforms, regardless of the kde-wide setting.
> > >
> > > Here's an updated one (which also compiles ;). Talked to David a
> > > bit on IRC and he pointed out that using
> > > KGlobalSettings::singleClick() is not a problem as long as I create
> > > a kcomponentdata before that. So thats what I changed.
> > >
> > > Anybody has objections against this patch?
> >
> > Second try :)
> 
> How expensive is creating a new KComponentData? How expensive is 
> KGlobalSettings::singleClick()? And how often is this style hint asked 
> for, i.e. do the first two questions matter?

Good questions actually :) 

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.

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.

Andreas

-- 
Live in a world of your own, but always welcome visitors.




More information about the kde-core-devel mailing list