0
我想在我的pyside應用程序中支持自定義協議,但沒有成功。到目前爲止,我嘗試過:Pyside qwebview自定義協議
class MainWindow(QWebView):
def __init__(self, parent=None):
oldManager = self.page().networkAccessManager()
self.page().setNetworkAccessManager(NetworkAccessManager(self, oldManager))
#in another file
class NetworkAccessManager(QNetworkAccessManager):
def __init__(self, parent, oldManager):
QNetworkAccessManager.__init__(self)
self.oldManager = oldManager
self.setCache(oldManager.cache())
self.setCookieJar(oldManager.cookieJar())
self.setProxy(oldManager.proxy())
self.setProxyFactory(oldManager.proxyFactory())
print('There')
def createRequest(self, operation, request, data):
print('And there')
這導致在windows下有segmentation fault
。我看到this:
目前不支持在PySide.QtWebKit.QWebPage使用它後更改網絡訪問管理器。
但我不明白它會在這種情況下使用。在設置網絡管理器和分段錯誤消失後,我嘗試設置網頁對象。
PS:控制檯內沒有任何打印語句顯示。