I have connected QSystemTrayIcon::ActivationReason to my 'handleClick' slot as below
connect(tray,SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this,SLOT(handleClick(QSystemTrayIcon::ActivationReason)));
mywindow::handleClick(QSystemTrayIcon::ActivationReason reason)
{
switch (reason)
{
case QSystemTrayIcon::Trigger:
case QSystemTrayIcon::DoubleClick:
handleLeftClickOnTray();
break;
case QSystemTrayIcon::MiddleClick:
break;
default:;
}
}
I have another function called 'handleRightClickOnSystemTray()' which should be called when mouse right button clicked over system tray icon. This function creates a QDialog box and display it. How to handle right click mouse events on system tray ?