Basically I want to invert the colors of my systrayicon only osx app when it is clicked (as normal on Mac apps), as is default behavior on mac apps. How would I d开发者_C百科o this now when aboutToHide() isn’t supported on Mac?
Can I code around it somehow? Using qt 4.7.3
I hawen't written for mac but try to catch click event and manually set icon with inverted colors...
void <YourClass>::onTrayIconActivated(QSystemTrayIcon::ActivationReason reason)
{
if(reason==QSystemTrayIcon::Trigger)
{
<Your tray object>->setIcon(<Icon with inverted colors>);
}
}
connect it to your trayIcon's signal activated()
if default behavior on mac is to invert icon colors back, you may do it with timer or something similar.
Can you set a selected state pixmap for your icon, e.g. myIcon->addPixmap(":/systray-selected.png", QIcon::Selected);
?
精彩评论