[PyKDE] KDE XML GUI ActionLists
Jim Bublitz
jbublitz at nwinternet.com
Tue Apr 22 21:50:00 BST 2003
On 22-Apr-03 Gordon Tyler wrote:
> Jim Bublitz wrote:
> According the documentation I've found for ActionList, this is
> the one case where one must *not* use the actionCollection() as
> the parent.
> Have a look at the "Dynamical menus" section:
> http://developer.kde.org/documentation/library/kdeqt/kde3arch/xmlg
> ui.html
He says:
"Note that in contrast to the static actions, the ones created here
are not constructed with the action collection as parent ..."
That's as clear as mud - especially since his code above that
doesn't show the arg list for the KAction call. I'd infer 'None'
from the rest of the line too, but I wouldn't feel real sure about
it. It also seems to me there was a change from KActionCollection
being optional to being mandatory, but that might have KDE2 ->
KDE3, or might only have affected non-XMLGUI uses (might be
imagining it too). I still think I'd try using
KMainWindow.actionCollection() and/or instantiating a separate
KActionCollection (just in place of the 'None' - not replacing the
list of KAction you generate).
I traced the code as far as kxmlguifactory_p.cpp in method
ContainerNode::plugActionList (the second one). That's seems to be
where stuff finally gets done. I didn't find anything that made me
think you'd have to have a KActionCollection, but I'm far from
understanding everything that's going on in that code.
I also looked at some (old) kdebase code like konqueror, and they
instantiate a new KActionCollection for some of the stuff that's
dynamic (but not using KXMLGUI I don't think), like bookmarks and
history.
Maybe check for typos again - I spent 15 minutes last night
tracking down a bug that turned out to be that I'd typed __ instead
of _ .
>> well, so that won't work right now either. If you want to try
>> it, in kaction.sip:
You don't need to do the bug fix to use KActionCollection here
(saves a compile if nothing else) - the only thing it affects is
a call to the 'actions()' methods.
Jim
More information about the PyQt
mailing list