Qt WebEngine Widgets C++ Classes

QWidget ベースのアプリケーションでウェブコンテンツをレンダリングするための C++ クラスを提供します。詳細...

クラス

QWebEngineView

Web ドキュメントの表示と編集に使用するウィジェット

詳細説明

Qt WebEngine Widgets モジュールは、ウェブ・ブラウザ・エンジンと、ウェブ・コンテンツをレンダリングして操作するための C++ クラスを提供します。

qmakeでビルドしてこのモジュールにリンクするには、qmake .proファイルに以下のQT変数を追加してください:

QT += webenginewidgets

CMake でビルドする場合は、find_package() コマンドを使用して Qt6 パッケージ内の必要なモジュールコンポーネントを探し、target_link_libraries() を使用してモジュールとリンクします:

find_package(Qt6 REQUIRED COMPONENTS WebEngineWidgets)
target_link_libraries(target PRIVATE Qt6::WebEngineWidgets)

HTMLページをロードして表示するために必要な最小限のコードでは、QWebEngineView クラスを実装するだけです。

#include <QApplication>
#include <QWebEngineView>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QWebEngineView view;
    view.load(QUrl("https://qt-project.org/"));
    view.resize(1024, 750);
    view.show();
    return app.exec();
}

© 2025 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.