问题
Is it possible to access the QNetworkCookieJar
in QtWebEngine
like you could before with QtWebKit
? I can't find it anywhere in the documentation...
回答1:
From Qt 5.6 onwards you can use the QWebEngineCookieStore class.
回答2:
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
来源:https://stackoverflow.com/questions/27675026/qt-5-access-cookies-in-qtwebengine