QML在我切换Windows之前不接受键盘事件
我正在QML开发某种视频播放器。我想通过键盘事件控制它,但问题是QML似乎不接受任何键盘事件,直到我切换窗口并卷土回到应用程序窗口。我尝试了 “焦点:真” “启用:true”
和 “焦点:项目”
,但对我没有任何帮助
I am developing some kind of a video player in QML. I want to control it by Keyboard events but the problem is that the qml doesn't seem to accept any keyboard event until I switch the window and comeback to the app window. I tried with
"focus: true"
"enabled : true"
and
"FocusScope: Item"
but nothing worked for me
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用
快捷方式
,则应禁用父页面中的快捷方式。main.qml
custompage.qml
If you use
Shortcut
you should disable the shortcuts in your parent pages.main.qml
CustomPage.qml
我通过追踪重点解决了这个问题。问题是在帧/页面开关期间,我失去了焦点。因此,我在每个帧上启用了 /a>。
I solved this problem by tracing the focus. The problem was during the frame/page switches I lost the focus. Hence I enabled it on each frame by forceActiveFocus.