Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我如何检测qt中箭头键之一的按下?此外,如果将其最小化,应用程序是否仍会检测到它们?
我如何检测qt中箭头键之一的按下?
通过处理层次结构中最顶层小部件中的按键事件。查看关键代码列表,您感兴趣的是 Qt::Left - Qt::Down 范围。
此外,如果将其最小化,应用程序是否仍会检测到它们?
不会。只有当它具有键盘的焦点时才会检测到它们,而最小化时则不会。您不能在 Qt 中以跨平台方式设置全局热键。