Qt WebAssembly问答,第1部分

Qt WebAssembly Q&A, Part 1

Qt WebAssembly问答,第1部分

September 12, 2022 by Laura Grant | Comments

​2022年9月12日 由劳拉·格兰特|评论

WebAssembly is a bytecode representation that is meant to be targeted by high-level programming languages such as C++ and to be executed inside a virtual machine in a browser. It will change the way you design your embedded devices, applications, and other software. Qt for WebAssembly allows you to run your C++ applications on popular web browsers, such as Google Chrome and Mozilla Firefox – and our efforts to support more browsers are continuous.

WebAssembly是一种字节码表示形式,旨在被高级编程语言(如C++)作为目标,并在浏览器中的虚拟机中执行。它将改变您设计嵌入式设备、应用程序和其他软件的方式。Qt for WebAssembly允许您在流行的web浏览器(如Google Chrome和Mozilla Firefox)上运行您的C++应用程序,我们一直致力于支持更多浏览器。

Want to find out more about WebAssembly but don't know what to ask? We quizzed our Senior Product Manager, Veli-Pekka Heinonen, with 11 burning questions sent to us by our dev community. This will be an ongoing series, so do not hesitate to send us your questions for our next edition!

​想了解更多关于WebAssembly的信息,但不知道该问什么?我们询问了我们的高级产品经理Veli Pekka Heinonen,我们的开发社区向我们发送了11个棘手的问题。这将是一个正在进行的系列,所以请不要犹豫,为我们的下一版发送您的问题!

1. Will WebAssembly support the SQL module?

1.WebAssembly是否支持SQL模块?

VP: SQLite is currently supported, being part of the QtSQL module. 

VP:目前支持SQLite,它是QtSQL模块的一部分。

2. What licence will Qt WebAssembly require in the Qt 6 Lifecycle? 

2.Qt WebAssembly在Qt 6生命周期中需要什么许可证?

VP: The WebAssembly platform adaptation is licensed under both GPLv3 and Commercial licenses. In other words, it is available for both open source and commercial customers. There are currently no plans to change this dual licensing model for WebAssembly. 

VP:WebAssembly平台适配在GPLv3和商业许可下获得许可。换句话说,它对开源和商业客户都是可用的。目前没有计划更改WebAssembly的这种双重许可模式。

Having said that, it is good to remember that additional value-add commercial-only modules such as DesignViewer, or GPLv3 modules such as Qt Charts, are for commercial only, or GPLv3 on all supported platforms for the module, also in addition to WebAssembly.

话虽如此,值得注意的是,除了WebAssembly之外,附加的增值商业模块(如DesignViewer)或GPLv3模块(如Qt Charts)仅适用于商业,或GPLv2在所有支持的平台上也适用于该模块。

3. When will Qt WebAssembly offer support for the iOS popup keyboard?

​3.Qt WebAssembly何时支持iOS弹出键盘?

VP: Qt 6.4 has experimental support for the iOS keyboard, bit this feature has not been completed yet.

VP:Qt 6.4对iOS键盘提供了实验性支持,但该功能尚未完成。

4. What is Qt doing to support development and deployment of secure WebAssembly applications, especially when accessing local hardware (e.g., audio)?

4.Qt如何支持安全WebAssembly应用程序的开发和部署,特别是在访问本地硬件(如音频)时?

VP: The WebAssembly platform provides base security features such as JavaScript sandbox that sets limits to what a web app can do. On top of that, Qt has worked on features such as local file access, for more details please visit: https://doc.qt.io/qt-6/wasm.html.

​VP:WebAssembly平台提供了基本的安全特性,如JavaScript沙盒,它限制了web应用程序的功能。除此之外,Qt还开发了本地文件访问等功能,详情请访问:https://doc.qt.io/qt-6/wasm.html.

5. Can a Qt Widget App be created in WebAssembly?

5.可以在WebAssembly中创建Qt Widget应用程序吗?

VP: It can, however, depending on the application requirements you may have to fine-tune some things to cater to the JavaScript sandbox and WebAssembly platform. Example areas to check are supported Qt modules , multithreading, networking and local file access. You can get a full view here: https://doc.qt.io/qt-6/wasm.html.

​VP:可以,但是,根据应用程序的要求,您可能需要对一些东西进行微调,以适应JavaScript沙盒和WebAssembly平台。要检查的示例区域包括支持的Qt模块、多线程、网络和本地文件访问。您可以在这里查看全貌:https://doc.qt.io/qt-6/wasm.html.

6. If our application uses other third-party libraries like VTK, ITK, and boost, how easy will the deployment process in WebAssembly be using Qt 6.4?

6.如果我们的应用程序使用其他第三方库,如VTK、ITK和boost,那么使用Qt 6.4在WebAssembly中的部署过程有多容易?

VP: Dynamic linking is not currently supported due to some platform limitations. However, work is ongoing to change that in upcoming versions. Static linking can already be used.

VP:由于某些平台限制,目前不支持动态链接。然而,在即将发布的版本中,正在努力改变这一点。已经可以使用静态链接。

7. Should we activate QT_EMSCRIPTEN_ASYNCIFY, multithreading for WASM?

7.我们应该为WASM激活QT_EMSCRIPTEN_ASYNCIFY多线程吗?

VP: Asyncify can be enabled if the application makes API calls which block the main thread, such as QDialog::exec(). Multithreading can be enabled if the application requires, or can benefit from using multiple threads in addition to the main thread.

VP:如果应用程序进行API调用阻止主线程,例如QDialog::exec(),则可以启用Asyncify。如果应用程序需要,可以启用多线程,或者可以从使用主线程之外的多线程中获益。

8. Is it possible now (or will it be in the future) to use WebAssembly (including UI) without QML?

8.在没有QML的情况下,现在(或将来)有可能使用WebAssembly(包括UI)吗?

VP: Qt for WebAssembly also supports widgets that provide a wide variety of functionality for the UI, although on a lower level. Also, screen reader base support is available for widgets in the dev branch (not in 6.4) for people to utilize if needed.

​VP:Qt for WebAssembly还支持为UI提供多种功能的widgets,尽管级别较低。此外,屏幕阅读器基础支持可用于dev分支(不是6.4)中的widgets,供人们在需要时使用。

9. Is WebAssembly fully supported in Qt 5.x?

9.Qt 5.x是否完全支持WebAssembly?

VP: Qt 5.15 supports WebAssembly as a target, however, with some feature limitations that are being addressed in Qt 6. Professional services can be used to port features from Qt 6 to Qt 5.

VP:Qt 5.15支持将WebAssembly作为目标,但Qt 6中存在一些功能限制。专业服务可用于将功能从Qt 6移植到Qt 5。

10. Can the Qt for WebAssembly app have access to a web API browser storage like localstorage or indexedDB through JavaScript?

10.Qt for WebAssembly应用程序是否可以通过JavaScript访问web API浏览器存储,如localstorage或indexedDB?

VP: File system access is sandboxed on the web, and this has implications for how the application works with files. The Web platform provides APIs for accessing the local file system in a way that is under user control, as well as APIs for accessing persistent storage. Emscripten and Qt wrap these features, and provide APIs which are easier to use from C++ and Qt-based applications.

VP:文件系统访问在web上是沙箱,这对应用程序如何处理文件有影响。Web平台提供用于以用户控制的方式访问本地文件系统的API,以及用于访问持久存储的API。Emscripten和Qt包装了这些特性,并提供了更易于在基于C++和Qt的应用程序中使用的API。

More info here: https://doc.qt.io/qt-6/wasm.html.

​更多信息请点击这里:https://doc.qt.io/qt-6/wasm.html.

11. Will Qt 6.4 support QOpenGLWidget in WebAssembly?

​11.Qt 6.4是否支持WebAssembly中的QOpenGLWidget?

VP: Yes, QOpenGLWidget now works with Qt 6.4

VP:是的,QOpenGLWidget现在可以,使用Qt 6.4

Have more questions or want to learn more about WebAssembly?

有更多问题或想了解更多关于WebAssembly的信息?

Head on over to our WebAssembly Demos & Examples

​前往我们的WebAssembly演示和示例

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值