Commit 0d8cde4
committed
fix: enforce baseLayer focus when launcher becomes visible
To address the low-probability issue where the launcher loses keyboard
focus upon opening (preventing direct text input), this commit explicitly
calls forceActiveFocus() on the baseLayer (InputEventItem) when
LauncherController.visible becomes true.
The focus acquisition check is deferred via Qt.callLater() to avoid
false warnings caused by QML's asynchronous focus event processing.
Unlike previous attempts that focused the searchEdit directly (which
violated the design requirement of not activating the search bar
visually upon open), this approach ensures the root item safely
receives key events and forwards them to the search edit without
triggering unwanted visual states.
修复启动器以极低概率打开时丢失键盘焦点(无法直接输入文本)的问题。
在启动器显示(LauncherController.visible 为 true)时,显式调用
baseLayer (InputEventItem) 的 forceActiveFocus() 强制获取活跃焦点。
焦点获取检查通过 Qt.callLater() 延迟执行,避免因 QML 焦点事件的
异步处理特性导致的误报警告。
与之前直接聚焦 searchEdit 的尝试(违背了打开时不直接激活搜索框
的设计要求)不同,此方法确保根节点能安全地接收按键事件并将其转发
给搜索框,同时不会触发不需要的视觉激活状态。
PMS: BUG-3017431 parent c5982f0 commit 0d8cde4
2 files changed
Lines changed: 18 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
887 | 887 | | |
888 | 888 | | |
889 | 889 | | |
890 | | - | |
891 | | - | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
892 | 899 | | |
893 | 900 | | |
894 | 901 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
305 | 305 | | |
306 | 306 | | |
307 | 307 | | |
308 | | - | |
309 | | - | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
310 | 317 | | |
311 | 318 | | |
312 | 319 | | |
| |||
0 commit comments