OS X 中 C++ 的全局快捷键
我目前正在开发一个位于系统托盘中的 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有
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.