构建网络应用程序

WebAssembly 是一种二进制格式,允许在网页中使用沙盒可执行代码。这种格式几乎与本地机器代码一样快。所有主流网络浏览器都支持这种格式。

使用Qt for WebAssembly以 WebAssembly 格式构建应用程序,并在本地网络浏览器上部署和运行。在项目的运行设置中更改网络浏览器。

注意: 启用 WebAssembly 插件才能使用它。

要为网络构建应用程序并在网络浏览器中运行,请安装 Qt for WebAssembly,使用 Qt Online Installer.它会自动添加一个构建和运行工具包到Qt Creator.NET Framework 4.0。

设置 WebAssembly 开发环境

为 WebAssembly 设置开发环境:

  1. 转到首选项>SDKs >WebAssembly
  2. Emscripten SDK path 中,输入安装emsdk 的根目录。
  3. Qt Creator 如果你的 Qt for WebAssembly 版本支持 ,《Qt XML》会为你配置 。emsdk Emscripten SDK environment

    SDK 偏好设置中的 WebAssembly 选项卡

  4. 转到首选项>Kits

    在 "工具包 "偏好设置的 "工具包 "选项卡中的 Qt for WebAssembly 工具包

  5. Build device 中,选择Desktop 作为设备类型。
  6. Run device 中,选择WebAssembly Runtime 作为设备类型。
  7. 如果Emscripten Compiler 没有为 C++ 和 C 自动设置,请检查 emscripten 是否设置正确。
  8. Qt version 中,选择 Qt XML for WebAssembly 版本。

另请参阅 在 Web 浏览器中运行应用程序

Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.