Multiple main window support, and action-collections
David Nolden
david.nolden.kdevelop at art-master.de
Mon Jul 27 08:45:31 UTC 2009
Am Montag 27 Juli 2009 10:20:59 schrieb Alexander Dymo:
> On Monday 27 July 2009 10:51:00 David Nolden wrote:
> > Am Montag 27 Juli 2009 01:29:17 schrieb Alexander Dymo:
> > > I'd say we need two functions in a plugin:
> > > //this would return action collection without a parent, and then will
> > > be //reparented to a mainwindow by mainwindow itself
> > > KActionCollection &IPlugin::guiActions()
> > > QString IPlugin::xmlGuiFile()
> >
> > Such an API also looks like it can return the same actions all the time,
> > which is not true. The actions have to be created uniquely for each
> > mainwindow.
>
> Right, so what about
> KActionCollection &IPlugin::createGuiActions()
>
> This API would also clearly divide responsibilities. Mainwindow has to
> create a KXMLGUIClient for each plugin and it will do that in a private
> function that would ask for xmlfile, actions and then construct a gui
> client. Therefore decoupling xmlfile getter from actions getter is not a
> problem.
Where should that returned reference point if it's supposed to be a completely
new action-collection with each call?
Also creating an action-collection is much more fuss than just getting one
given, like in the current API.
Additionally, action-collections are QObject based and thus not copyable, so
it would have to be "KActionCollection* IPlugin::createGuiActions()" if
anything. And any C++ programmer should know that you shouldn't deal with
pointers if you don't have to. ;-)
Greetings, David
More information about the KDevelop-devel
mailing list