QWebEngineHttpRequest Class

QWebEngineHttpRequest クラスは、WebEngine で送信するリクエストを保持します。詳細...

ヘッダー #include <QWebEngineHttpRequest>
CMake: find_package(Qt6 REQUIRED COMPONENTS WebEngineCore)
target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore)
qmake: QT += webenginecore

パブリックな型

enum Method { Get, Post }

パブリック関数

QWebEngineHttpRequest(const QUrl &url = QUrl(), const QWebEngineHttpRequest::Method &method = QWebEngineHttpRequest::Get)
QWebEngineHttpRequest(const QWebEngineHttpRequest &other)
~QWebEngineHttpRequest()
bool hasHeader(const QByteArray &headerName) const
QByteArray header(const QByteArray &headerName) const
QList<QByteArray> headers() const
QWebEngineHttpRequest::Method method() const
QByteArray postData() const
void setHeader(const QByteArray &headerName, const QByteArray &headerValue)
void setMethod(QWebEngineHttpRequest::Method method)
void setPostData(const QByteArray &postData)
void setUrl(const QUrl &url)
void swap(QWebEngineHttpRequest &other)
void unsetHeader(const QByteArray &key)
QUrl url() const
bool operator!=(const QWebEngineHttpRequest &other) const
QWebEngineHttpRequest &operator=(const QWebEngineHttpRequest &other)
bool operator==(const QWebEngineHttpRequest &other) const

静的パブリックメンバ

QWebEngineHttpRequest postRequest(const QUrl &url, const QMap<QString, QString> &postData)

詳細説明

QWebEngineHttpRequest は、WebEngine ネットワーキング・スタックにおける HTTP リクエストを表します。リクエストをネットワーク経由で送信するために必要な情報を保持します。URL と、リクエストを変更するために使用できる補助的な情報が含まれています。QWebEnginePage::load() とQWebEngineView::load() はどちらも QWebEngineHttpRequest をパラメータとして受け取ります。

メンバ型ドキュメント

enum QWebEngineHttpRequest::Method

この列挙型は HTTP リクエストの送信に使われるメソッドを記述します:

定数説明
QWebEngineHttpRequest::Get0GET メソッド。
QWebEngineHttpRequest::Post1POST メソッド。

メンバ関数のドキュメント

[explicit] QWebEngineHttpRequest::QWebEngineHttpRequest(const QUrl &url = QUrl(), const QWebEngineHttpRequest::Method &method = QWebEngineHttpRequest::Get)

url をリクエストする URL、method を使用するメソッドと して QWebEngineHttpRequest オブジェクトを構築します。

url() およびsetUrl()も参照してください

QWebEngineHttpRequest::QWebEngineHttpRequest(const QWebEngineHttpRequest &other)

other のコピーを作成する。

[noexcept] QWebEngineHttpRequest::~QWebEngineHttpRequest()

QWebEngineHttpRequest オブジェクトを破棄します。

bool QWebEngineHttpRequest::hasHeader(const QByteArray &headerName) const

このWebEngine リクエストにヘッダーheaderName が存在する場合、true を返す。

setHeader()、header()、unsetHeader() およびheaders()も参照のこと

headerName で指定されたヘッダーを返す。そのようなヘッダーが存在しない場合、空のQByteArray が返される。これは、ヘッダーは存在するが内容がないものと区別できないかもしれない (ヘッダーが存在するかどうかを調べるにはhasHeader() を使用する)。

ヘッダーはsetHeader() で設定できる。

setHeader()、hasHeader()、unsetHeader()、headers()参照のこと。

QList<QByteArray> QWebEngineHttpRequest::headers() const

このWebEngine リクエストで設定されているすべてのヘッダーのリストを返す。リストはヘッダが設定された順番に並べられます。

setHeader()、header()、hasHeader() およびunsetHeader()も参照

QWebEngineHttpRequest::Method QWebEngineHttpRequest::method() const

このWebEngine リクエストが使用しているメソッドを返します。

setMethod()も参照ください

QByteArray QWebEngineHttpRequest::postData() const

このWebEngine リクエストが含む (生の) POST データを返します。

setPostData()も参照ください

[static] QWebEngineHttpRequest QWebEngineHttpRequest::postRequest(const QUrl &url, const QMap<QString, QString> &postData)

POST メソッドを使用するQWebEngineHttpRequest からurl を構築する。

注: postData は任意の文字列を含むことができる。それらは適切な生データに変換されます。

postData およびsetPostData()も参照

void QWebEngineHttpRequest::setHeader(const QByteArray &headerName, const QByteArray &headerValue)

ヘッダーheaderName の値をheaderValue に設定する。

注意: 同じヘッダを2回設定すると、前の設定が上書きされます。同じ名前の複数の HTTP ヘッダの動作を実現するには、2 つの値をカンマ (",") で区切って連結し、1 つのヘッダを設定する必要があります。

header(),hasHeader(),unsetHeader(),headers()も参照の こと。

void QWebEngineHttpRequest::setMethod(QWebEngineHttpRequest::Method method)

このWebEngine リクエストが使用しているメソッドをmethod に設定する。

method()も参照のこと

void QWebEngineHttpRequest::setPostData(const QByteArray &postData)

このWebEngine リクエストが含む(生の)POSTデータをpostData に設定する。

postData()も参照

void QWebEngineHttpRequest::setUrl(const QUrl &url)

このWebEngine リクエストが参照している URL をurl に設定する。

url()も参照のこと

[noexcept] void QWebEngineHttpRequest::swap(QWebEngineHttpRequest &other)

このWebEngine リクエストをother と交換する。この関数は非常に高速で、失敗することはない。

void QWebEngineHttpRequest::unsetHeader(const QByteArray &key)

key で指定されたヘッダーが存在する場合、それを削除する。

setHeader()、header()、hasHeader()、headers()も参照のこと

QUrl QWebEngineHttpRequest::url() const

このWebEngine リクエストが参照している URL を返す。

setUrl()も参照

bool QWebEngineHttpRequest::operator!=(const QWebEngineHttpRequest &other) const

このオブジェクトがother と同じでない場合はfalse を返す。

operator==()も参照

QWebEngineHttpRequest &QWebEngineHttpRequest::operator=(const QWebEngineHttpRequest &other)

other のコピーを作成する。

bool QWebEngineHttpRequest::operator==(const QWebEngineHttpRequest &other) const

このオブジェクトがother と同じ場合 (つまり、メソッド、URL、ヘッダが同じ場合)、true を返す。

operator!=()も参照

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