[Interest] help with tray menus

Jakob Magiera JAM at ivu.de
Tue Aug 25 16:13:08 CEST 2015


My approach: create an action repository which holds all your menu actions, then rebuild the menu from scratch every time the repository changes.
It's basically the view/model approach, you could use a signal to refresh the menu.

Jakob

-----Ursprüngliche Nachricht-----
Von: interest-bounces+jam=ivu.de at qt-project.org [mailto:interest-bounces+jam=ivu.de at qt-project.org] Im Auftrag von jubalh
Gesendet: Dienstag, 25. August 2015 11:48
An: interest at qt-project.org
Betreff: [Interest] help with tray menus

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.

regards,
jubalh

1: http://fitztrev.github.io/shuttle/
2: https://github.com/jubalh/buran
3: https://github.com/jubalh/buran/blob/master/mainwindow.cpp#L96
_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list