[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: KAction Menus
From: Kurt Granroth <granroth () kde ! org>
Date: 2000-06-13 22:02:18
[Download RAW message or body]
Federico David Sacerdoti wrote:
> I am trying to add my own menu to an app with the KAction framework. I am
> trying the following code which doesn't seem to work too well.
>
> -- Inside a KTMW-derived constructor:
> options=new KActionMenu(i18n("&Search Options"), this, "options");
> options->plug(menuBar());
>
> I even have some XML commands in the rc file, which do not seem to help either:
>
> <MenuBar>
> <Menu name="file"><text>&File</text>
> <Action name="add_module"/>
> </Menu>
> <Menu name="options"><text>&Search Options</text>
> </Menu>
> </MenuBar>
>
> Nothing. Am I using KActionMenu correctly? I could not find any API
> docs on it.
Right.. you're actually doing quite a few things wrong :-) Where to
start..
1) KActionMenu should only be used for dynamic menus -- ones that will
change after compile time. It looks like all you want here is a
regular menu... you don't need KActionMenu for that.
2) You are mixing XML-GUI and the "old" action way together. If you
are using XML-GUI, then you don't need to "plug" anything in. In
fact, it will screw things up if you do and don't know exactly what
you're doing. Use XML-GUI, don't plug anything.
3) Don't use 'this' as the parent for any actions. Use
'actionCollection()' as the XML-GUI framework needs it
4) You can't insert a KActionMenu as a menu like you show. It's an
<Action> not a <Menu>.
One of the reasons that KActionMenu isn't documented is that it's a
very specialized class. Only a *very* tiny number of apps need it.
--
Kurt Granroth | http://www.granroth.org
KDE Developer/Evangelist | SuSE Labs Open Source Developer
granroth@kde.org | granroth@suse.com
KDE -- Putting a Friendly Face on Unix
>> Visit http://master.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