The QWebEngineHttpRequest class holds a request to be sent with WebEngine. More...
Header: | #include <QWebEngineHttpRequest> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS WebEngineCore) target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore) |
qmake: | QT += webenginecore |
Since: | Qt 5.9 |
enum | Method { Get, Post } |
QWebEngineHttpRequest(const QWebEngineHttpRequest &other) | |
QWebEngineHttpRequest(const QUrl &url = QUrl(), const QWebEngineHttpRequest::Method &method = QWebEngineHttpRequest::Get) | |
QWebEngineHttpRequest & | operator=(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 |
bool | operator==(const QWebEngineHttpRequest &other) const |
QWebEngineHttpRequest | postRequest(const QUrl &url, const QMap<QString, QString> &postData) |
QWebEngineHttpRequest represents an HTTP request in the WebEngine networking stack. It holds the information necessary to send a request over the network. It contains a URL and some ancillary information that can be used to modify the request. Both QWebEnginePage::load() and QWebEngineView::load() accept a QWebEngineHttpRequest as a parameter.
This enum type describes the method used to send the HTTP request:
Constant | Value | Description |
---|---|---|
QWebEngineHttpRequest::Get |
0 |
The GET method. |
QWebEngineHttpRequest::Post |
1 |
The POST method. |
Creates a copy of other.
Constructs a QWebEngineHttpRequest object with url as the URL to be requested and method as the method to be used.
Creates a copy of other.
Disposes of the QWebEngineHttpRequest object.
Returns true
if the header headerName is present in this WebEngine request.
See also setHeader(), header(), unsetHeader(), and headers().
Returns the header specified by headerName. If no such header is present, an empty QByteArray is returned, which may be indistinguishable from a header that is present but has no content (use hasHeader() to find out if the header exists or not).
Headers can be set with setHeader().
See also setHeader(), hasHeader(), unsetHeader(), and headers().
Returns a list of all headers that are set in this WebEngine request. The list is in the order that the headers were set.
See also setHeader(), header(), hasHeader(), and unsetHeader().
Returns the method this WebEngine request is using.
See also setMethod().
Returns the (raw) POST data this WebEngine request contains.
See also setPostData().
[static]
QWebEngineHttpRequest QWebEngineHttpRequest::postRequest(const QUrl &url, const QMap<QString, QString> &postData)Constructs a QWebEngineHttpRequest to url that uses the POST method.
Note: postData may contain arbitrary strings. They are translated to appropriate raw data.
See also postData and setPostData().
Sets the header headerName to be of value headerValue.
Note: Setting the same header twice overrides the previous setting. To accomplish the behavior of multiple HTTP headers of the same name, you should concatenate the two values, separating them with a comma (",") and set one single header.
See also header(), hasHeader(), unsetHeader(), and headers().
Sets the method this WebEngine request is using to be method.
See also method().
Sets the (raw) POST data this WebEngine request contains to be postData.
See also postData().
Sets the URL this WebEngine request is referring to be url.
See also url().
Swaps this WebEngine request with other. This function is very fast and never fails.
Removes the header specified by key, if present.
See also setHeader(), header(), hasHeader(), and headers().
Returns the URL this WebEngine request is referring to.
See also setUrl().
Returns false
if this object is not the same as other.
See also operator==().
Returns true
if this object is the same as other (that is, if they have the same method, URL, and headers).
See also operator!=().