Eva*_*ain 4 python pyqt pyqt5 qtwebengine qtwebchannel
我有一个使用 QWebChannel 创建谷歌地图实例的小部件。当在 javascript 中实例化 QWebChannel 时,会出现几个警告:
Property 'accessibleName'' of object 'MapWindow' has no notify signal and is not constant, value updates in HTML will be broken!
Property 'accessibleDescription'' of object 'MapWindow' has no notify signal and is not constant, value updates in HTML will be broken!
Property 'layoutDirection'' of object 'MapWindow' has no notify signal and is not constant, value updates in HTML will be broken!
Property 'autoFillBackground'' of object 'MapWindow' has no notify signal and is not constant, value updates in HTML will be broken!
Property 'styleSheet'' of object 'MapWindow' has no notify signal and is not constant, value updates in HTML will be broken!
Property 'locale'' of object 'MapWindow' has no notify signal and is not constant, value updates in HTML will be broken!
Property 'windowFilePath'' of object 'MapWindow' has no notify signal and is not constant, value updates in HTML will be broken!
Property 'inputMethodHints'' of object 'MapWindow' has no notify signal and is not constant, value updates in HTML will be broken!
Run Code Online (Sandbox Code Playgroud)
Property 'accessibleName'' of object 'MapWindow' has no notify signal and is not constant, value updates in HTML will be broken!
Property 'accessibleDescription'' of object 'MapWindow' has no notify signal and is not constant, value updates in HTML will be broken!
Property 'layoutDirection'' of object 'MapWindow' has no notify signal and is not constant, value updates in HTML will be broken!
Property 'autoFillBackground'' of object 'MapWindow' has no notify signal and is not constant, value updates in HTML will be broken!
Property 'styleSheet'' of object 'MapWindow' has no notify signal and is not constant, value updates in HTML will be broken!
Property 'locale'' of object 'MapWindow' has no notify signal and is not constant, value updates in HTML will be broken!
Property 'windowFilePath'' of object 'MapWindow' has no notify signal and is not constant, value updates in HTML will be broken!
Property 'inputMethodHints'' of object 'MapWindow' has no notify signal and is not constant, value updates in HTML will be broken!
Run Code Online (Sandbox Code Playgroud)
var backend = null;
new QWebChannel(qt.webChannelTransport, function(channel) {
backend = channel.objects.backend;
backend.getRef(function(ref) {
backend.getCenter(function(center) {
backend.getPoints(function(points){
map = new google.maps.Map(document.getElementById('map'), {
center: center[0],
zoom: 10
});
...
Run Code Online (Sandbox Code Playgroud)
QWebChannel 将分析注册对象的 q 属性,验证它们是否具有关联的信号。在您的警告消息的情况下,我推断“self”是一个 QWidget,因此它有许多 q 属性,没有关联的信号来指示错误。
鉴于以上情况,有2种解决方案:
QtCore.qInstallMessageHandler(lambda *args: None)
Run Code Online (Sandbox Code Playgroud)
class Backend(QObject):
# getRef, getCenter, getPoints
Run Code Online (Sandbox Code Playgroud)
self.backend = Backend(self)
self.webchannel.registerObject('backend', self.backend)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
592 次 |
| 最近记录: |