问题
I'm using QWebEngineView
with QWebChannel
, similar to this:
class AppView(QWebEngineView):
def __init__(self):
QWebEngineView.__init__(self)
self.ch = QWebChannel(self.page())
self.page().setWebChannel(self.ch)
Then I call:
self.ch.registerObject('app',self)
and everything runs correctly. However, I then get log-spam like this:
...
Property 'title'' of object 'AppView' has no notify signal and is not constant, value updates in HTML will be broken!
Property 'url'' of object 'AppView' has no notify signal and is not constant, value updates in HTML will be broken!
Property 'selectedText'' of object 'AppView' has no notify signal and is not constant, value updates in HTML will be broken!
Property 'hasSelection'' of object 'AppView' has no notify signal and is not constant, value updates in HTML will be broken!
Property 'zoomFactor'' of object 'AppView' has no notify signal and is not constant, value updates in HTML will be broken!
...
These seem to be the properties of the derived QWebEngineView
class that have been pulled in. Is there a way to correctly derive this, or does the whole structure need to change so that I'm not pulling in QWebEngineView
?
AppView
has other signals and slots needed in the JS code.
回答1:
Disable all qt warnings:
QtCore.qInstallMessageHandler(lambda x,y,z: None)
Feed your custom handler-function inside for detail filtration
来源:https://stackoverflow.com/questions/54227435/eliminate-qwebchannel-property-notifier-signal-warnings