[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: How getting a KXmlGuiFactory created KMenu pointer ?
From:       "Nicolas Ternisien" <nicolas.ternisien () gmail ! com>
Date:       2007-08-21 7:57:57
Message-ID: ccba71b50708210057k49b37b50jf9092a9431926d05 () mail ! gmail ! com
[Download RAW message or body]

Okay, I think I've found a solution :

In the KWord source, they add a simple Action in the configuration,
and use KActionMenu class, which can add sub-actions.

(see insert_expression Action)

Config file :
http://websvn.kde.org/trunk/koffice/kword/part/kword.rc?view=markup

Source file
http://websvn.kde.org/trunk/koffice/kword/part/KWView.cpp?view=markup
(the KActionMenu use is commented for the moment)

Thanks for your help !

Regards.

2007/8/21, Nicolas Ternisien <nicolas.ternisien@gmail.com>:
> Hi,
>
> Thank you for your solution, it works well, but it seems that I could
> not add sub menus dynamically.
>
> Is there a way to create them dynamically too ?
>
> Regards.
>
> Nicolas
>
> 2007/8/21, Ian Wadham <ianw2@optusnet.com.au>:
> > On Tue, 21 Aug 2007 09:54 am, Nicolas Ternisien wrote:
> > > I would like to retrieve a specifical QMenu* pointer after it has been
> > > created by the KXmlGuiWindow class. I need this pointer to be able to
> > > add dynamic actions which could not be inserted manually in the *ui.rc
> > > config file.
> > >
> > Maybe this can help ... In your <app_name>ui.rc file you can have an
> > ActionList entry, example:
> >            <ActionList            name="theme_list" />
> > This is a place where you can plug/unplug an arbitrary list of menu
> > items and actions, as determined at execution time.  In my example
> > they come from a set of "theme" files (*.desktop) found in the file
> > system and contributed by artists.
> >
> > There is an example of code to do this at KGoldrunner::setupThemes()
> > in kdegames/kgoldrunner/src/kgoldrunner.cpp.  The key operations
> > are at the end, where "theme_list" is referenced in methods to
> > unplugActionList and plugActionList in KXmlGui...  These methods
> > should be used *after* you have run setupGUI() and created a spot
> > to receive your dynamic action list.  In my example the menu item
> > names are extracted from the *.desktop files, translated I trust.
> >
> > Cheers, Ian W.
> >
> > >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
> >
>
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic