libkonq and kactioncollection
David Faure
faure at kde.org
Mon Dec 20 19:00:48 GMT 2004
On Monday 20 December 2004 19:51, Benjamin Meyer wrote:
> - m_actionCollection = new KActionCollection( this );
> + m_actionCollection = new KActionCollection( (QWidget*)this );
Looks wrong. Either "this" was a QWidget already and this isn't needed, or it's not
a QWidget and your change crashes.
> void KateExternalToolsMenuAction::reload()
> {
> - m_actionCollection->clear ();
> + KAction *it = m_actionCollection->action(0);
> + while ( it ){
> + m_actionCollection->remove( it );
> + it = m_actionCollection->action(0);
> + }
Well this needs more thinking IMHO. Either this code needs to be redesigned (not just
working around the lack of clear),or clear() wasn't deprecated for a good reason.
I don't know what KateExternalToolsMenuAction does, but if m_actionCollection
is just for bookkeeping, a QValueList<KAction *> would be better - and then you have clear() again.
[PS: I was wrong about KonqPopupMenu, that one uses the actioncollection correctly
now, it even calls setWidget later on]
--
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the kde-core-devel
mailing list