Qt 5: Access Cookies in QtWebEngine

2019-02-15 12:54发布

Is it possible to access the QNetworkCookieJar in QtWebEngine like you could before with QtWebKit? I can't find it anywhere in the documentation...

2条回答
戒情不戒烟
2楼-- · 2019-02-15 12:58

From Qt 5.6 onwards you can use the QWebEngineCookieStore class.

查看更多
你好瞎i
3楼-- · 2019-02-15 13:09

QNetworkCookie is available for QtWebEngine, but only through the old QNetworkAccessManager as QtWebEngine is using its own HTTP implementation. You can notice this while reading one of the examples:

contains(DEFINES, QWEBENGINEPAGE_SETNETWORKACCESSMANAGER) {
    HEADERS += cookiejar.h networkaccessmanager.h
    SOURCES += cookiejar.cpp networkaccessmanager.cpp
}

Please refer to the following example for details:

WebEngine Tab Browser Example

查看更多
登录 后发表回答