QWebEngineUrlRequestJob Class

The QWebEngineUrlRequestJob class represents a custom URL request. 更多...

头文件: #include <QWebEngineUrlRequestJob>
开始支持版本: Qt 5.6
基类: QObject

公有类型

enum Error { NoError, UrlNotFound, UrlInvalid, RequestAborted, RequestDenied, RequestFailed }

公有函数

void fail(Error r)
void redirect(const QUrl &url)
void reply(const QByteArray &contentType, QIODevice *device)
QByteArray requestMethod() const
QUrl requestUrl() const
  • 32 个公有函数继承自 QObject

其他继承的成员

  • 1 个属性继承自 QObject
  • 1 个公有槽函数继承自 QObject
  • 2 个信号继承自 QObject
  • 1 个公有变量继承自 QObject
  • 10 个静态公有成员继承自 QObject
  • 9 个受保护的函数继承自 QObject
  • 2 个受保护的变量继承自 QObject

详细描述

The QWebEngineUrlRequestJob class represents a custom URL request.

A QWebEngineUrlRequestJob is given to QWebEngineUrlSchemeHandler::requestStarted() and must be handled by the derived implementations of the class. The job can be handled by calling either reply(), redirect(), or fail().

The class is owned by the web engine and does not need to be deleted. However, the web engine may delete the job when it is no longer needed, and therefore the signal QObject::destroyed() must be monitored if a pointer to the object is stored.

成员类型

enum QWebEngineUrlRequestJob::Error

This enum type holds the type of the error that occurred:

ConstantValueDescription
QWebEngineUrlRequestJob::NoError0The request was successful.
QWebEngineUrlRequestJob::UrlNotFound1The requested URL was not found.
QWebEngineUrlRequestJob::UrlInvalid2The requested URL is invalid.
QWebEngineUrlRequestJob::RequestAborted3The request was canceled.
QWebEngineUrlRequestJob::RequestDenied4The request was denied.
QWebEngineUrlRequestJob::RequestFailed5The request failed.

成员函数

void QWebEngineUrlRequestJob::fail(Error r)

Fails the request with the error r.

参见 Error.

void QWebEngineUrlRequestJob::redirect(const QUrl &url)

Redirects the request to url.

void QWebEngineUrlRequestJob::reply(const QByteArray &contentType, QIODevice *device)

Replies to the request with device and the MIME type contentType.

QByteArray QWebEngineUrlRequestJob::requestMethod() const

Returns the HTTP method of the request (for example, GET or POST).

QUrl QWebEngineUrlRequestJob::requestUrl() const

Returns the requested URL.