diff options
author | Leena Miettinen <riitta-leena.miettinen@qt.io> | 2018-03-05 16:16:29 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-03-08 11:19:27 +0000 |
commit | c6505f14bce8b12ddd1df6f85ea185d0111eb7f3 (patch) | |
tree | 3f34afb862bae853f59dc665945b0dfad4bc3b65 | |
parent | 38b56f720bee4e1a8316b452003fc800dcf6a008 (diff) |
Doc: Add code snippet to QWebEngineCookieStore::setCookieFilter() docs
Task-number: QTBUG-66723
Change-Id: Ic59f2bea41d6f5a4b0a1ca2b27ed7cce79b4a6ce
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r-- | src/core/api/qwebenginecookiestore.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/core/api/qwebenginecookiestore.cpp b/src/core/api/qwebenginecookiestore.cpp index 713dcdf6d..583ca1df8 100644 --- a/src/core/api/qwebenginecookiestore.cpp +++ b/src/core/api/qwebenginecookiestore.cpp @@ -336,9 +336,20 @@ void QWebEngineCookieStore::deleteAllCookies() \since 5.11 Installs a cookie filter that can prevent sites and resources from using cookies. - The \a filterCallback must be a lambda or functor taking a FilterRequest structure. If the + The \a filter must be a lambda or functor taking a FilterRequest structure. If the cookie is to be rejected, the filter can set FilterRequest::accepted to \c false. + The following code snippet illustrates how to set a cookie filter: + + \code + profile->setCookieFilter( + [&allowThirdPartyCookiesSetting](QWebEngineCookieStore::FilterRequest &request) + { request.accepted = !request.thirdParty || allowThirdPartyCookiesSetting; } + ); + \endcode + + You can unset the filter with a nullptr argument. + The callback should not be used to execute heavy tasks since it is running on the IO thread and therefore blocks the Chromium networking. |