PyQT OSX 媒体密钥 [英] PyQT OSX Media Keys

查看:46
本文介绍了PyQT OSX 媒体密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 PyQT 创建一个音乐播放器应用程序,我已经将它们定义为工具栏按钮.我可以使用 setShortcut 轻松设置快捷方式,但如何将它们设置为 OS X 媒体键?我已经在启动时禁用了 iTunes,所以没问题.当应用程序未聚焦时,音乐播放器 Clementine 也可以使用它们,我如何拥有全局"热键?

I'm creating a music player app with PyQT and I've defined a couple them as toolbar buttons. I can easily set the shortcut with setShortcut, but how can I set them to the OS X Media Keys? I already have iTunes disabled on launch so that's no problem. The music player Clementine has them also working when the application is not in focus, how can I have "global" hotkeys?

非常感谢!

丹尼斯

推荐答案

当您使用 OSX 本地方法时,您只会获得全局热键,这些方法似乎在每个次要版本中都发生了变化.libQxt 中提供了一个较旧的示例(即在 Lion AFAIK 中不起作用)

You only get global hot keys when you use the OSX native methods which seemingly change every minor release. An older example of this (i.e. doesn't work in Lion AFAIK) is available in libQxt

https://bitbucket.org/libqxt/libqxt/src/956e213e4f2d/src/gui/qxtglobalshortcut_mac.cpp

这篇关于PyQT OSX 媒体密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆