Tray icon is not launching the activated() signal
Hello, I’m working in Ubuntu 11.10, and I have the following problem:
I call this to connect the tray to the SIGNAL:
- connect(trayIcon,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(clickSysTrayIcon(QSystemTrayIcon::ActivationReason)));
but as I checked, clickSysTrayIcon() function never launches! So, even if I’ve set to do something on single click (trigger) or to quit application on middle click, using this code:
- {
- //reason is a variable that holds the type of activation or click done on the icon tray
- switch (reason) {
- //normal click
- if(must_do_action){
- do_action();
- return;
- }
- if(!pref && !histor){//hide the icon
- trayIcon->hide();
- //show the main window
- this->showNormal();
- }
- break;
- //quit the application
- close();
- break;
- break;
- break;
- default :
- ;
- }
- }
nothing’s working… When I click the application the menu I’ve designed shows up and I can click the actions I’ve specified, which are working fine. Middle click to close app or normal click so as to do an action or to open the mainwindow, does not work.
Any ideas?
3 replies
Hello Volker, thanks for the info. I (maybe :D) forgot to add that Ubuntu doesn’t really support tray icons and by default accepts indicators. In some cases, (I think especially if tray icons are Qt ones) it does accept tray icons but it may have disabled some functions of them. This may cause the problem, but any other thoughts rather than this?
PS: does QtCreator plan to make a library which supports indicators?
Thanks!
You must log in to post a reply. Not a member yet? Register here!


