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:
@void MainWindow::clickSysTrayIcon(QSystemTrayIcon::ActivationReason reason)
{
//reason is a variable that holds the type of activation or click done on the icon tray
switch (reason) {
case QSystemTrayIcon::Trigger:
//normal click
if(must_do_action){
do_action();
return;
}
if(!pref && !histor){//hide the icon
trayIcon->hide();
//show the main window
this->showNormal();
}
break;case QSystemTrayIcon::MiddleClick: //quit the application close(); break; case QSystemTrayIcon::Unknown: break; case QSystemTrayIcon::Context: 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?
-
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!