在 Qt4 中单击后反转系统托盘图标中的颜色?
基本上,我想在单击时反转仅 systrayicon 的 osx 应用程序的颜色(与 Mac 应用程序上的正常情况一样),就像 Mac 应用程序上的默认行为一样。当 Mac 不支持 aboutToHide() 时,我现在该怎么做?
我可以以某种方式围绕它编写代码吗?使用qt 4.7.3
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 do this now when aboutToHide() isn’t supported on Mac?
Can I code around it somehow? Using qt 4.7.3
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不是为 mac 编写的,但尝试捕获点击事件并手动设置具有反转颜色的图标...
请将其连接到您的托盘图标的信号
activated()
如果 mac 上的默认行为是将图标颜色反转回来, ,你可以用定时器或类似的东西来做。
I hawen't written for mac but try to catch click event and manually set 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.
您可以为图标设置选定状态像素图,例如
myIcon->addPixmap(":/systray-selected.png", QIcon::Selected);
吗?Can you set a selected state pixmap for your icon, e.g.
myIcon->addPixmap(":/systray-selected.png", QIcon::Selected);
?