Problem with KActions stored in multiple action collections

David Faure faure at
Tue Mar 18 09:53:03 GMT 2008

On Tuesday 18 March 2008, Michael Jansen wrote:
> I don't know why or even if it worked before, Parker says it worked. A short 
> grep over kdebase lead me to the conclusion a KActionCollection is mainly 
> created with new for global shortcuts and these work without a 
> associatedWidget. 
> There is one other use case in konqmainwindow but this actionCollection is 
> getting added to a KonqBookmarkMenu somehow utilizing a kmenu and ... i got 
> lost there ...  looks like qt magic above my head.

Yes the bookmarks menu uses a separate action collection so that the bookmarks don't
show up in the toolbar editor, as the comment says. No shortcuts there, so no problem.

I thought there were many more standalone action collections.... ah yeah there are some
as member vars, too:
konqguiclients.h:    KActionCollection m_actionCollection;

> Question is. Should it work without addAssociatedWidget(). If not i would 
> propose to add this requirement to the documentation of KActionCollection.

Assuming "it" means shortcuts: yes, it has always been a requirement to associate
the action or the collection with a widget, for shortcuts to work; in kde3 too.

David Faure, faure at, sponsored by Trolltech to work on KDE,
Konqueror (, and KOffice (

More information about the kde-core-devel mailing list