本页内容

Qt WebView 示例 - 一个关于 WebView 的简易示例Qt Quick

本示例演示了如何将 QtWebView 模块与Qt Quick 结合使用。

在 Android 设备上显示 Qt 网站的 Web 视图

Minibrowser 通过Qt Quick Controls 和 QtWebView 提供基本的浏览体验。除了用于输入 URL 的地址栏外,它还提供了一些控件,用于浏览历史记录。

注意: 使用 QtWebView 模块时, 必须在创建QGuiApplication 实例之前立即调用QtWebView::initialize()。调用QtWebView::initialize() 可确保执行必要的预配置步骤。

    QtWebView::initialize();
    QGuiApplication app(argc, argv);

运行示例

您可以通过以下方式运行示例:

示例项目 @ code.qt.io

© 2026 The Qt Company Ltd. 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.