[Interest] help with tray menus
Rutledge Shawn
Shawn.Rutledge at theqtcompany.com
Tue Aug 25 16:22:05 CEST 2015
On 25 Aug 2015, at 11:48, jubalh <jubalh at openmailbox.org> wrote:
> Hi,
>
> I am trying to learn Qt and as a pet project I wanted to rebuild a
> simple program [1].
> At first everything went quite smooth but now I am having a problem
> which I can't solve on my own, so I hope this list is the right place to
> get some help
>
> My project is located at [2].
>
> I created an application with an tray icon. I buld the menu in there
> dynamically. Now I would like to create submenus. So AFAIK an
> "addAction" adds a normal entry that can be clicked upon. "addMenu"
> creates a submenu with an arrow so you can add Actions in there.
>
> So far the relevant code looks like [3].
> Now I would like that if the content of variable name is
> "sub1/sub2/entry" I create two submenus and then add the action.
>
> So my problem is if one time I have work/test/srv1 and another
> work/test/srv2 I need to go through the menu to see if work/test already
> exists so i don't create it again. But for some reason i don't find a
> method which can retrieve entries from a menu or go through the menu..
> So I see no way to check whether the submenus already exist.
>
> Hope someone can help me here.
If you are on Linux and try to create submenus dynamically, you may run into this bug:
https://bugreports.qt.io/browse/QTBUG-46293
Support for the D-Bus tray icons and menus is relatively new, so I have some more work to do there.
In any case, the sample code from the bug report may be helpful.
More information about the Interest
mailing list