开发者

Qt closing tray icon after application stops

开发者 https://www.devze.com 2023-02-19 21:04 出处:网络
I\'ve a little problem with tray icon under windows. After my Qt application stopps (normal 开发者_如何转开发exit) the icon still remains in system bar. It disapears only when I move mouse cursor over

I've a little problem with tray icon under windows. After my Qt application stopps (normal 开发者_如何转开发exit) the icon still remains in system bar. It disapears only when I move mouse cursor over it. I tried to hide it in the destructor of my window but it fails: I tried .setVisible(false).

Any ideas? Thanks.

P.S. I remember I had the same problem with SWT/Java.


I wouldn't hide it in the destructor. It will likely be an invalid reference at that point. I would put it in where your event for "Exit" happens.


If you're not able to call it from a destructor, you could connect the QCoreApplication::aboutToQuit() signal to the QSystemTrayIcon::hide() slot.

0

精彩评论

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