qt - Query which QT element has focus
问题描述
Is it possible to query which QT element currently has focus?
I'm currently working with a program and the action I want to implement requires a specific element to have focus. Instead of trying to track down through the hierarchy from the top which element I need, I'm wondering if it's possible to select the element in the UI and then query it so that I can trace it's path upwards.
解决方案
If you want to know that QWidget has the focus then use the QApplication::focusWidget()
method, you can also use the focusChanged
signal
推荐阅读
- python - 是否可以通过将字典传递给脚本来调用脚本?
- apache-spark - pyspark:返回所有单元格匹配正则表达式的列
- vuejs2 - 实现handsontable时未定义导航器
- javascript - 将 svg 存储在浏览器缓存中并在需要时检索
- java - oracle数据库中数据仓库的SQL语句查询示例
- javascript - 如何检查 api 调用是否已完成
- botframework - 使用 Typscript 创建的虚拟助手 - 在 Bot Framework Emulator 中运行没有响应
- c# - Razor 类库不包含 DLL 中的视图
- java - 弹性搜索 JPA 存储库不提供 findAll 和 findBy... 方法的结果
- nginx - Nginx - 为不同的用户将 cookie 从一个 url 设置到另一个