消除QWebChannel属性通知程序信号警告 [英] Eliminate QWebChannel property notifier signal warnings

查看:1122
本文介绍了消除QWebChannel属性通知程序信号警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将QWebEngineViewQWebChannel一起使用,类似于:

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)

然后我打电话给

self.ch.registerObject('app',self)

,一切正常运行.但是,然后我得到了这样的日志垃圾邮件:

and everything runs correctly. However, I then get log-spam like this:

...
对象'AppView'的属性'title'没有通知信号并且不是常量,HTML中的值更新将被破坏!
对象'AppView'的属性'url'没有通知信号并且不是常量,HTML中的值更新将被破坏!
对象'AppView'的属性'selectedText'没有通知信号并且不是常量,HTML中的值更新将被破坏!
对象'AppView'的属性'hasSelection'没有通知信号并且不是常量,HTML中的值更新将被破坏!
对象'AppView'的属性'zoomFactor'没有通知信号并且不是常量,HTML中的值更新将被破坏!
...

...
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!
...

这些似乎是已引入的派生QWebEngineView类的属性.是否有一种方法可以正确派生此属性,或者是否需要更改整个结构,以使我不会引入QWebEngineView ?

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具有JS代码中所需的其他信号和插槽.

AppView has other signals and slots needed in the JS code.

推荐答案

禁用所有qt警告:

QtCore.qInstallMessageHandler(lambda x,y,z: None)

在内部输入您的自定义处理程序功能以进行详细过滤

Feed your custom handler-function inside for detail filtration

这篇关于消除QWebChannel属性通知程序信号警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆