如何让我的应用程序出现在系统托盘中?
如何让我的应用程序出现在系统托盘中?
我已经有一个 QDialog 小部件,其父级为 qApp->mainWidget() 并禁用了任务栏条目。现在我需要它出现在系统托盘中。
我正在使用 Qt 3.3
How can I make my application appear in the system tray?
I already have a QDialog widget with parent as qApp->mainWidget() and disabled the task bar entry. Now I need it to appear in the system tray.
I am using Qt 3.3
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我首先要说的是,你可能在浪费时间。我似乎无法在 Qt 3.3 文档 中找到任何暗示您想要的内容。然而,在 Qt 4.8 中,引入了一个 QSystemTrayIcon 类在 Qt 4.2 中。
通常,当新类替换旧类时,Qt 文档会这么说,因此我怀疑是否编写了任何代码来处理 3.3 中支持的平台上的系统托盘图标。
此外,即使您确实在 3.3 中找到了某些功能,它现在也不太可能起作用,因为从那时起大多数操作系统可能已经更改了其 GUI。
我的答案?更新到4.8并使用QSystemTrayIcon。
I'll start by saying you're probably wasting your time. I can't seem to find anything in the Qt 3.3 documentation which alludes to what you want. However in Qt 4.8 there is a QSystemTrayIcon class, which was introduced in Qt 4.2.
Normally, when a new class replaces an old class the Qt documentation says so, therefore I doubt any code was written to handle system tray icons across the supported platforms in 3.3.
Furthermore, even if you do find something in 3.3, it's unlikely it will work now as most OSes are likely to have changed their GUIs since then.
My answer? Update to 4.8 and use QSystemTrayIcon.