2

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.

ekhumoro
  • 115,249
  • 20
  • 229
  • 336
Dre Westcook
  • 603
  • 6
  • 7
  • 1
    One solution is simply to avoid registering objects with properties which have no notifier signal (e.g. use a delegate that subclasses `QObject`). That may be inconvenient in many cases, though. So it may be preferable to [install a message handler](https://doc.qt.io/qt-5/qtglobal.html#qInstallMessageHandler) and just filter out all the log spam at source. – ekhumoro Jan 17 '19 at 15:34

1 Answers1

0

Disable all qt warnings:

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

Feed your custom handler-function inside for detail filtration

KnsRoo
  • 11
  • 1