Eliminate QWebChannel property notifier signal warnings

风流意气都作罢 提交于 2019-12-19 11:59:14

问题


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

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