[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Accessing a (sub)menu defined in an XmlGui ui.rc file
From: David Hurka <david.hurka () mailbox ! org>
Date: 2021-01-13 22:53:20
Message-ID: 2181300.ElGaqSPkdT () doro
[Download RAW message or body]
On Wednesday, January 13, 2021 10:39:48 AM CET Tobias Leupold wrote:
> Hi list :-)
>
> I have a problem with a KXmlGuiWindow and I honestly can't find respective
> docs or howtos/tutorials. I hope someone here can help me ...
I faced the same problem... :(
> It's a allegedly basic task: How can I access a submenu (or better: a
> submenu's QAction) for a menu defined in a ...ui.rc file?
>
> If I define the submenu like so:
>
> <MenuBar>
> <Menu name="foo" >
> <Menu name="bar">
> <text>Some text</text>
> <Action name="someAction"/>
> </Menu>
> </Menu>
> </MenuBar>
I probably don't understand properly what you need. But if you want to modify
the action which contains the menu "bar", you could use KActionMenu.
Change the ui.rc to:
<MenuBar>
<Menu name="foo" >
<Action name="bar"/>
</Menu>
</MenuBar>
then create a KActionMenu called "bar" in your KActionCollection, set its icon
etc., and populate its menu.
Of course this moves UI definition from ui.rc to C++ code, but it looks like
you want to modify the menu at runtime.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic