proposed KAction/KActionCollection API changes

Simon Hausmann hausmann at
Wed Jan 3 22:17:00 GMT 2007

On Wednesday 03 January 2007 13:48, Hamish Rodda wrote:
> Hi,
> Firstly, thanks for doing this, I'm happy with these changes in general. 
> I'm assuming there are no feature regressions (from the discussions I've
> seen that would seem to be the case).  Can we now even assign global
> shortcuts to QActions?  I guess that's a small task once this is done.

That's actually not supported yet. Though of course it shouldn't be hard to 
implement I think. Famous last words :)

> On Wednesday 03 January 2007 08:30, Simon Hausmann wrote:
> <snip>
> > 2) Actions need to be explicitly added to the actioncollection. The name
> > used for extraction from the actioncollection (and with xmlgui) is
> > specified when adding the action to the collection, for symmetry. We
> > would like to use KActionCollection::addAction(const QString &name,
> > QAction *action) for that.
> To me it is a little unfortunate that this becomes more verbose, but no big
> deal.  More concerning is the higher chance of porting bugs (missed
> addAction calls).  Still, if liveui does eventually get completed,
> hopefully all of this code will be autogenerated.

Liveui is indeed on the next plate, after these cleanups :)

> For actions with no name, do you pass QString() as the name parameter?  Or
> is this now frowned upon..

Actually right now the old fallback code is still in place, which means 
actions without a name are tried with objectName() first and then the old 
sprintf("unnamed-%p", (void *)action) trick :)

> > [ 4) Get rid of the ugly setObjectName() hiding in KAction ]
> [ Although it looks ugly now, it served its purpose and I thought it looked
> beautiful back then ;) ]
> So to change the associated name in the action collection you just remove
> and re-add the action?

Good thing you mention that! I forgot about it. Of course it shouldn't be 
necessary to remove the action, insert should become replace. Added to my 

> PS. I hope someone is looking at task 108509... it would be nice if it
> didn't slip for 4.3.

I'm fairly optimistic about that one :)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <>

More information about the kde-core-devel mailing list