Qt 5: Access Cookies in QtWebEngine

我们两清 提交于 2019-12-06 11:04:38

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!