You can do an winEvent, but have a look at QWidget::enterEvent, as this tells you when the mouse enters the widget, you can do something similar with ordinary event and QEvent::MouseMove.
This makes the tricky part, as you can do a custom class with a subclass of QWidget and QSystemTrayIcon. (which I don't know if would work...)
But the easier solution is probably to reimplement ::event(QEvent*e)
Somthing linke this:
bool SystTrayIcon
::event( QEvent e
) {
switch ( e->type() ) {
/*
Do Mouse Move stuff Here
Should happen when the mouse is over your systray icon
*/
break;
case QEvent::MouseButtonPress: /* Button Press things here */
break;
case QEvent::MouseButtonRelease: / * Do mouse release button stuff */
break;
case QEvent::MouseButtonDblClick: / * Do mouse double click stuff */
break;
default:
}
bool SystTrayIcon::event( QEvent e )
{
switch ( e->type() ) {
case QEvent::MouseMove:
/*
Do Mouse Move stuff Here
Should happen when the mouse is over your systray icon
*/
break;
case QEvent::MouseButtonPress:
/* Button Press things here */
break;
case QEvent::MouseButtonRelease:
/ * Do mouse release button stuff */
break;
case QEvent::MouseButtonDblClick:
/ * Do mouse double click stuff */
break;
default:
return QObject::event( e );
}
To copy to clipboard, switch view to plain text mode
Have a look at how the systray implements the clicks if you want same functionality as it has for those options.
Bookmarks