Multiple main window support, and action-collections

David Nolden david.nolden.kdevelop at art-master.de
Sun Jul 26 21:57:19 UTC 2009


Am Sonntag 26 Juli 2009 23:44:09 schrieb Andreas Pakulat:
> On 26.07.09 22:26:05, David Nolden wrote:
> > Am Sonntag 26 Juli 2009 21:52:50 schrieb David Nolden:
> > > Am Sonntag 26 Juli 2009 20:26:34 schrieb Andreas Pakulat:
> > > > One thing I'm not sure right now is wether a given KAction can be
> > > > added to multiple clients/action collections. IIRC KActionCollection
> > > > does a setParent (don't have the sources at hand), so we'd need need
> > > > to "clone" actions...
> > >
> > > No they cannot. That's exactly the problem I'm talking about. There is
> > > no way around creating new actions for each mainwindow as it seems.
> > > That mainwindow argument is not exactly needed while creating those
> > > actions, but I think it's consistent giving it when a method is called
> > > "createActionsForMainWindow".
> >
> > Just tested it, no it's not possible to add the same action to the action
> > collections of two mainwindows. It has no effect in the second one.
> >
> > And since KAction is a normal QObject with connections etc., and may have
> > a set defaultWidget(), I guess it's not possible to just clone both,
> > including all their active connections.
>
> I don't think defaultWidget() will be a problem, the plugins actions
> won't have one as those are generally not bound to a widget. The only
> widget a plugin can provide is a toolview and there can be multiple of
> that. Hence having a default widget on the action doesn't make much
> sense.
defaultWidget() is used to set custom widgets on toolbar actions, for example 
the quickopen line. And a separate quickopen line is needed for each 
mainwindow. And we shouldn't limit the possible widgets that can be used for 
the toolbar.

> Another possible but not very nice option would be creating multiple
> instances of a plugin and binding them to the mainwindow....
I though of that as well. But that could really be quite messy.

So now I'm about to commit something like the function above. It allows 
creating a set of actions and setting an xml file.

If required, a different function can be overloaded, which allows creating a 
custom per-window KXMLGuiClient.

Greetings, David





More information about the KDevelop-devel mailing list