开发者

Invert colors in system tray icon upon click in Qt4?

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); ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜