代码拉取完成,页面将自动刷新
import QtQuick 2.0
import QtWebEngine 1.5
import QtWebChannel 1.0
import QtQuick.Controls 2.2
Item{
clip:true
WebChannel{
id:htmlchannel
objectName: "objwebchannel"
registeredObjects:webchannelobject
}
QtObject{
id:webchannelobject
objectName: "objobject"
WebChannel.id: "content"
signal createmarker(var lat, var lng, string msg)
signal clearmarker
function buildingmap(){
console.log("building map")
}
}
WebEngineView {
url:"file://"+RootController.getMcConfigInfo("[MCUIInfo]" , "baidumaphtml")
width: parent.width
height: parent.height
y:-7
x:-7
webChannel: htmlchannel
onLoadProgressChanged: {
if(loadProgress === 100){
createmcmarker.running = true
}
}
}
property string mcinfo: ""
Timer{
id:createmcmarker
interval: 1000
triggeredOnStart: false
running: false
repeat: false
onTriggered: {
console.log("Offline Map Over")
mcinfo = "<h4 style='margin:0 0 5px 0;padding:0.2em 0'>"+RootController.getMcConfigInfo("[MCUIInfo]" , "name")+"</h4>" +
"<img style='float:right;margin:4px' id='imgDemo' src='images/MC.jpg' width='139' height='104' title='天安门'/>" +
"<p style='margin:0;line-height:1.5;font-size:13px;text-indent:2em'>"+RootController.getMcConfigInfo("[MCUIInfo]" , "descr")+"</p>" +
"</div>"
webchannelobject.createmarker(RootController.getMcConfigInfo("[MCUIInfo]" , "lat"),
RootController.getMcConfigInfo("[MCUIInfo]" , "lng"),
mcinfo)
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。