Problem with KActions stored in multiple action collections
Michael Jansen
info at michael-jansen.biz
Tue Mar 18 09:31:28 GMT 2008
Hi
From the qt doc
Actions are added to widgets using QWidget::addAction(). Note
that an action must be added to a widget before it can be used;
this is also true when the shortcut should be global (i.e.,
Qt::ApplicationShortcut as Qt::ShortcutContext).
That's what happened to Parker. The KActionCollection returned from
KXMGUIClient::actionCollection() gets the MainWindow added implicitely ( see
KXMLGUIClient::beginXMLPlug ) but a actionCollection created with "new
KActionCollection()" not.
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.
Question is. Should it work without addAssociatedWidget(). If not i would
propose to add this requirement to the documentation of KActionCollection.
Mike
Am Sonntag 16 März 2008 02:12:40 schrieb Parker Coates:
> On Sat, Mar 15, 2008 at 6:42 PM, Michael Jansen <info at michael-jansen.biz>
wrote:
> > Hi
> >
> > If that problem still exists try:
> >
> > m_keyboardActions.associateWidget(this);
>
> Thanks a lot. That did indeed make them work, as did
> addAssociatedWidget(this).
>
> If you need me to try anything else in order to figure out what's
> going on, just let me know. I'd be glad to help out further.
>
> Thanks again,
>
> Parker
-------------------------------------------------------
More information about the kde-core-devel
mailing list