QSystemTrayIcon to handle both double left click and single left click!
I am trying to achieve two different things when the user left single click and left double click on my tray icon. Left single click will only display the context menu and left double click will start the application. But unfortunately it is not working, because my slot for activated signal only handles trigger when the user double click my tray icon. Any thought will be very helpful. Thanks.
Re: QSystemTrayIcon to handle both double left click and single left click!
How you handle QSystemTrayIcon::ActivationReason? If i'm not mistaken, when user double-clicked the tray icon, QSystemTrayIcon::activated signal emitted twice, first it send QSystemTrayIcon::Trigger, after that it send QSystemTrayIcon::DoubleClick.
Re: QSystemTrayIcon to handle both double left click and single left click!
You are absolutely right. My code is handling trigger signal but ignoring the DoubleClicked signal. I don't know why, any idea?
Re: QSystemTrayIcon to handle both double left click and single left click!
Can you post the source code for handling activate signal?
Re: QSystemTrayIcon to handle both double left click and single left click!
Here is my code.
Code:
void SystemTray
::onSystemTrayLeftClicked( QSystemTrayIcon::ActivationReason Reason
) {
updateTrayStates( ) ;
{
m_pActionTrayLogin->trigger() ; //
this
->contextMenu
()->popup
(QCursor::pos());
}
}
Re: QSystemTrayIcon to handle both double left click and single left click!
Please use [code] tag to format code.
Re: QSystemTrayIcon to handle both double left click and single left click!
Thanks for reminding me. But that was a type-o.
Re: QSystemTrayIcon to handle both double left click and single left click!
Quote:
My code is handling trigger signal but ignoring the DoubleClicked signal
Have you debug? Are you sure the slot doesn't called when the tray icon double-clicked?