Accessing a (sub)menu defined in an XmlGui ui.rc file
Tobias Leupold
tobias.leupold at gmx.de
Wed Jan 13 16:21:47 GMT 2021
I still don't get it :-D All I get is nullptrs ...
Maybe I'm missing the forest for the trees?!
I now attached a minimal example showing my dilemma. After having put
demoui.rc to ~/.local/share/kxmlgui5/demo/, the GUI is setup nicely and all,
but how do I get a pointer to the "subMenu" menu? To e. g. assign an icon to
it's action or to disable the whole menu?!
Am Mittwoch, 13. Januar 2021, 14:58:25 CET schrieb Ismael Asensio:
> Once you have the main QAction, it has a menu() method, which in turn has
> an actions() method.
>
> So for instance:
> bar = foo->menu()->actions().at(0).
>
> Of course with much more logic to check that every item exists and not
> hardcoding the position, but I hope you get the point.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CMakeLists.txt
Type: text/x-cmake
Size: 388 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-devel/attachments/20210113/e6b16b87/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: demoui.rc
Type: application/vnd.kde.kxmlguirc
Size: 547 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-devel/attachments/20210113/e6b16b87/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cpp
Type: text/x-c++src
Size: 1034 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-devel/attachments/20210113/e6b16b87/attachment.cpp>
More information about the kde-devel
mailing list