用于移动设备上的Qt for WebAssembly

Qt for WebAssembly on mobile devices

用于移动设备上的Qt for WebAssembly

Tuesday March 15, 2022 by Lorn Potter | Comments

​2022年3月15日星期二洛恩·波特 | 评论

Qt for WebAssembly on mobile devices, specifically phones, has lacked an essential feature - support for the native keyboard. It may or may not have worked. If it worked, it did not work very well. The tricky issue is opening the keyboard when needed and closing when it wasn't. There is no simple API for doing that on any platform we target - iOS, Android and Windows.

Qt for WebAssembly在移动设备(尤其是手机)上缺乏一项基本功能——对本机键盘的支持。它可能有效,也可能无效。如果成功了,效果也不太好。棘手的问题是需要时打开键盘,不需要时关闭键盘。在我们瞄准的任何平台上——iOS、Android和Windows——都没有简单的API来实现这一点。

Although it feels a bit hacky to me to open the keyboard using javascript , we use Emscripten's C++ interface to create a hidden javascript text input element and set focus to that, which opens the platform keyboard.

虽然用JavaScript打开键盘感觉有点不太好,但是我们使用Emscripten的C++接口创建一个隐藏的JavaScript文本输入元素,并将焦点设置为打开平台键盘。

Emscripten on Android had one other issue - the usual Emscripten input event API was not working. Nothing being typed on the native virtual keyboard was being handled like on other platforms. I found I could utilize the hidden input element that is used to pop up the keyboard, to listen for input characters and then send them to Qt. 

Android上的Emscripten还有一个问题——通常的Emscripten输入事件API不起作用。在本机虚拟键盘上键入的内容没有像在其他平台上那样得到处理。我发现我可以利用隐藏的输入元素来弹出键盘,监听输入字符,然后将它们发送到Qt。

As it is, this patch adds support for native mobile keyboard for iOS, Android and Windows on Qt for WebAssembly. (now merged into dev as 66a76a5def46d0e4a330f7130ad440c639b87cf7), too late to make it into 6.3.

​事实上,这个补丁增加了对iOS、Android和Windows上Qt for WebAssembly的本机移动键盘的支持。(现在作为66a76a5def46d0e4a330f7130ad440c639b87cf7合并到开发中),太晚了,无法进入6.3版。

Other issues on mobile are memory (as usual). Up until recently, Safari limits browser memory to much less than the other browsers. 

移动设备上的其他问题是内存(和往常一样)。直到最近,Safari还将浏览器内存限制在比其他浏览器少得多的范围内。

Other areas that Qt covers for mobile devices that do not work on Qt for WebAssembly yet are sensors and bluetooth connectivity. Although there is a patch for some sensors support, it has not been merged and probably needs updating. It may not work at all, either.

Qt还包括传感器和蓝牙连接,这些领域适用于尚未在Qt for WebAssembly上运行的移动设备。虽然有一个补丁支持某些传感器,但尚未合并,可能需要更新。它也可能根本不起作用。

Bluetooth connectivity for javascript is currently only supported on the Chrome browser and is currently experimental. While I could probably add this support to Qt WebAssembly, it would not get merged and the API might be too changey.

针对javascript的蓝牙连接目前仅在Chrome浏览器上受支持,目前处于试验阶段。虽然我可能会将此支持添加到Qt WebAssembly中,但它不会被合并,而且API可能太多变。

Any areas you find Qt WebAssembly is lacking on mobile, please report to System Dashboard - Qt Bug Tracker

​如果您发现移动设备上缺少Qt WebAssembly,请向系统仪表板-Qt Bug Tracker报告

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值