Qt WebAssembly问答,第1部分

Qt WebAssembly Q&A, Part 1

Qt WebAssembly问答,第1部分

October 14, 2022 by Laura Grant | Comments

​2022年10月14日Laura Grant评论

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)仅用于商业,或GPLv 3在所有支持的平台上用于模块。

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,尽管处于较低级别。此外,开发分支(而非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
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值