The QWebEngineUrlRequestInterceptor class provides an abstract base class for URL interception. 更多...
| 頭: | #include <QWebEngineUrlRequestInterceptor> |
| Since: | Qt 5.6 |
| 繼承: | QObject |
| QWebEngineUrlRequestInterceptor (QObject * p = ...) | |
| virtual void | interceptRequest (QWebEngineUrlRequestInfo & info ) = 0 |
| const QMetaObject | staticMetaObject |
The QWebEngineUrlRequestInterceptor class provides an abstract base class for URL interception.
實現 QWebEngineUrlRequestInterceptor 接口並在 Profile 安裝攔截器,使 URL 請求到達 Chromium 網絡堆棧之前能夠對其進行攔截、阻塞及修改。
您可以在 Profile 安裝攔截器憑藉 QWebEngineProfile::setRequestInterceptor () 或 QQuickWebEngineProfile::setRequestInterceptor ().
當使用 Qt WebEngine Widgets 模塊 , QWebEnginePage::acceptNavigationRequest () 提供接受或阻塞請求的進一步選項。
另請參閱 interceptRequest () 和 QWebEngineUrlRequestInfo .
創建新的 QWebEngineUrlRequestInterceptor 對象采用 p 作為父級。
[pure virtual]
void
QWebEngineUrlRequestInterceptor::
interceptRequest
(
QWebEngineUrlRequestInfo
&
info
)
Reimplementing this virtual function makes it possible to intercept URL requests. This function is executed on the IO thread, and therefore running long tasks here will block networking.
info 包含 URL 請求的有關信息,並將在內部跟蹤其成員是否已變更。
警告: 會阻塞主綫程對 Profile (配置文件) 所有方法的調用,直到此函數執行完成。