OS X 中 C++ 的全局快捷键

发布于 2024-12-25 23:18:38 字数 231 浏览 2 评论 0原文

我目前正在开发一个位于系统托盘中的 QT 应用程序(用 C++ 编写),并且需要全局快捷方式。目前,QT 似乎没有提供向操作系统注册全局快捷方式的方法。我已经找到了 Qxt (http://libqxt.org),但是由于各种原因这个库还不够。

因此,我正在寻找一种在 OS X 中注册全局快捷方式的方法,这样即使我的应用程序没有焦点(记住它在系统托盘中!),我仍然可以与其功能进行交互。

有什么想法如何实现这一点?

I am currently working on a QT application (in C++) that lives in the system tray, and requires a global shortcut. Currently it does not seem as though QT provides a way to register global shortuts with the OS. I've located Qxt (http://libqxt.org), however for various reasons this library will not suffice.

Therefore, I am looking for a way to register a global shortcut within OS X, so that even if my application does not have focus (remember it's in the system tray!) that I can still interact with its functionality.

Any ideas how to accomplish this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

邮友 2025-01-01 23:18:38

RegisterEventHotKey (Carbon)。完整的文章可以在这里找到

您还可以安装CGEventTap。这写起来稍微复杂一些,但仍然很短。 可以在此处找到演示< /a>.

There's RegisterEventHotKey (Carbon). A thorough write up can be found here.

You could also install a CGEventTap. This is slightly more complex to write, but still quite short. A demo can be found here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文