调用C++;来自JavaScript的函数

调用C++;来自JavaScript的函数,javascript,c++,qt,Javascript,C++,Qt,我尝试使用QWebChannel用JavaScript文件链接QWebEngineView 这是我的HTML文件(qmapview在mapapi.js中声明): 我想从js文件中调用object的函数(类似于qmapview.mapZoomChanged();),但现在我不想这样做 我读过关于Q_财产的书,但不明白 在类似以下内容的调试中: Property 'visible'' of object 'MapWidget' has no notify signal and is not cons

我尝试使用
QWebChannel
用JavaScript文件链接
QWebEngineView
这是我的HTML文件(
qmapview
mapapi.js
中声明):

我想从js文件中调用object的函数(类似于
qmapview.mapZoomChanged();)
,但现在我不想这样做

我读过关于Q_财产的书,但不明白

在类似以下内容的调试中:

Property 'visible'' of object 'MapWidget' has no notify signal and is not constant, value updates in HTML will be broken!
Property 'minimized'' of object 'MapWidget' has no notify signal and is not constant, value updates in HTML will be broken!
Property 'maximized'' of object 'MapWidget' has no notify signal and is not constant, value updates in HTML will be broken!
Property 'fullScreen'' of object 'MapWidget' has no notify signal and is not constant, value updates in HTML will be broken!

下面是我根据本文档所做的详细文档。我们有相同的问题,但在“客户端必须使用并设置qwebchannel.js提供的JavaScript API。对于在Qt WebEngine内部运行的客户端,您可以通过qrc:///qtwebchannel/qwebchannel.js. 对于外部客户端,您需要将文件复制到web服务器。“这个问题已经为我们解决了。还可以看看Q_可调用宏@你能说说你选择了哪条路吗。我设置了这个:它存在,我检查过了,但不起作用
 m_webChannel = new QWebChannel();
    m_webpage->setWebChannel(m_webChannel);
    m_webChannel->registerObject("qmapview", this) ;
Property 'visible'' of object 'MapWidget' has no notify signal and is not constant, value updates in HTML will be broken!
Property 'minimized'' of object 'MapWidget' has no notify signal and is not constant, value updates in HTML will be broken!
Property 'maximized'' of object 'MapWidget' has no notify signal and is not constant, value updates in HTML will be broken!
Property 'fullScreen'' of object 'MapWidget' has no notify signal and is not constant, value updates in HTML will be broken!