On Thursday, 2013-08-08, Jan Kundrát wrote:
> On Thursday, 8 August 2013 10:44:44 CEST, Pali Rohár wrote:
> > In XML file are defined menubars and toolbars with all K/QActions.
> > It matching objectName(). In your cpp code you need to push all
> > KActions objects to some list (KActionCollection).
> > 
> > My Kontact plugin will got pointers to QAction objects via
> > findChild and push them to KActionCollection list. It also install
> > needed XML file.
> 
> Looks like you're doing the right thing, then. Thomas, could you please
> comment?

I think what Thomas was suggesting was to make the action objects directly 
accessible instead of making Qt traverse the QObject tree to find them.
The action objects are members of the MainWindow class after all.

I see a couple of different approaches:
- like Thomas suggested TrojitaPart could be a friend of MainWindow
- MainWindow could have a method that returns all actions in a list
- MainWindow could have a method that returns a single action per name
- MainWindow could have the action protected, createActions() virtual and the 
Part would have a subclass that overwrites createActions(), first calls the 
base implementation and then puts the actions into the action collection

At some point it might be worth to consider a refactoring such that the 
Trojita main UI is a widget and both TrojitaPart and MainWindow use it.

Cheers,
Kevin
-- 
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to