PyQt - QWebView 启用应用程序缓存?

PyQt - QWebView Enables Application Cache?

我想知道如何在用 python 编写的 Qt 程序中启用 application cache

使用此代码: 请记住将 '__your_path__' 更改为您喜欢存储数据的路径。

settings = QWebSettings.globalSettings()
settings.setAttribute(QWebSettings.LocalStorageEnabled, True)
settings.setAttribute(QWebSettings.OfflineWebApplicationCacheEnabled, True)
settings.enablePersistentStorage('__your_path__')

如果只用OfflineWebApplicationCacheEnabled,那只会是没有用的!记得也使用 enablePersistentStorage