资源简介
这是使用webengineView来嵌入百度地图的Demo,通过Qt加载index.html和百度的key以及使用JS交互来实现的。
代码片段和文件信息
#include “bridge.h“
#include
#include
#include
bridge* bridge::instance()
{
static bridge s_obj;
return &s_obj;
}
bridge::bridge()
{
}
void bridge::Init()
{
AddLight();
AddLight();
}
Light_t bridge::AddLight()
{
static int s_count = 1;
Light_t tLight;
tLight.strName = QString(“Light%1“).arg(s_count);
tLight.strDesc = QString(“Light Description %1“).arg(s_count);
tLight.fLng = 121.0 + s_count*0.1;
tLight.fLat = 37.3 + s_count*0.01;
tLight.nValue = 0;
m_lightList.append(tLight);
s_count++;
return tLight;
}
QVariantList bridge::GetLightData()
{
int nCount = m_lightList.count();
QVariantList markerList;
for(int i=0; i {
Light_t tLight = m_lightList[i];
QVariantMap map;
map.insert(“name“ tLight.strName);
map.insert(“description“ tLight.strDesc);
map.insert(“point“ QString(“%1%2“).arg(tLight.fLng).arg(tLight.fLat));
map.insert(“value“ tLight.nValue);
markerList << map;
}
return markerList;
}
void bridge::onLightOn(QString strName)
{
SetLightValue(strName 1);
}
void bridge::onLightOff(QString strName)
{
SetLightValue(strName 0);
}
void bridge::SetLightValue(QString strName int nValue)
{
int nCount = m_lightList.count();
for(int i=0; i {
Light_t tLight = m_lightList[i];
if( m_lightList[i].strName == strName)
{
m_lightList[i].nValue = nValue;
break;
}
}
emit sigLightStatus(strName nValue);
}
void bridge::onUpdateData()
{
emit sigUpdateLight();
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-06-03 23:43 28.BaiduMap\BaiduMap\
文件 432 2018-06-03 23:26 28.BaiduMap\BaiduMap\BaiduMap.pro
文件 23334 2018-06-03 23:24 28.BaiduMap\BaiduMap\BaiduMap.pro.user
文件 1761 2018-06-03 23:36 28.BaiduMap\BaiduMap\bridge.cpp
文件 936 2018-06-03 23:36 28.BaiduMap\BaiduMap\bridge.h
文件 183 2018-06-03 23:24 28.BaiduMap\BaiduMap\main.cpp
文件 1669 2018-06-03 23:36 28.BaiduMap\BaiduMap\mainwindow.cpp
文件 556 2018-06-03 23:36 28.BaiduMap\BaiduMap\mainwindow.h
文件 2796 2018-06-03 23:43 28.BaiduMap\BaiduMap\mainwindow.ui
目录 0 2018-06-03 23:36 28.BaiduMap\build-BaiduMap-Desktop_Qt_5_6_0_MSVC2015_64bit-Debug\
目录 0 2018-06-03 23:37 28.BaiduMap\build-BaiduMap-Desktop_Qt_5_6_0_MSVC2015_64bit-Debug\debug\
文件 145920 2018-06-03 23:43 28.BaiduMap\build-BaiduMap-Desktop_Qt_5_6_0_MSVC2015_64bit-Debug\debug\BaiduMap.exe
文件 1461448 2018-06-03 23:43 28.BaiduMap\build-BaiduMap-Desktop_Qt_5_6_0_MSVC2015_64bit-Debug\debug\BaiduMap.ilk
文件 3166208 2018-06-03 23:43 28.BaiduMap\build-BaiduMap-Desktop_Qt_5_6_0_MSVC2015_64bit-Debug\debug\BaiduMap.pdb
文件 211181 2018-06-03 23:36 28.BaiduMap\build-BaiduMap-Desktop_Qt_5_6_0_MSVC2015_64bit-Debug\debug\bridge.obj
文件 2843 2017-01-13 01:31 28.BaiduMap\build-BaiduMap-Desktop_Qt_5_6_0_MSVC2015_64bit-Debug\debug\circle_green.png
文件 2910 2017-01-13 01:31 28.BaiduMap\build-BaiduMap-Desktop_Qt_5_6_0_MSVC2015_64bit-Debug\debug\circle_grey.png
文件 3961 2018-06-03 12:20 28.BaiduMap\build-BaiduMap-Desktop_Qt_5_6_0_MSVC2015_64bit-Debug\debug\index.html
文件 96288 2018-06-03 23:36 28.BaiduMap\build-BaiduMap-Desktop_Qt_5_6_0_MSVC2015_64bit-Debug\debug\main.obj
文件 226609 2018-06-03 23:43 28.BaiduMap\build-BaiduMap-Desktop_Qt_5_6_0_MSVC2015_64bit-Debug\debug\mainwindow.obj
文件 5799 2018-06-03 23:36 28.BaiduMap\build-BaiduMap-Desktop_Qt_5_6_0_MSVC2015_64bit-Debug\debug\moc_bridge.cpp
文件 103810 2018-06-03 23:36 28.BaiduMap\build-BaiduMap-Desktop_Qt_5_6_0_MSVC2015_64bit-Debug\debug\moc_bridge.obj
文件 4060 2018-06-03 23:36 28.BaiduMap\build-BaiduMap-Desktop_Qt_5_6_0_MSVC2015_64bit-Debug\debug\moc_mainwindow.cpp
文件 100434 2018-06-03 23:36 28.BaiduMap\build-BaiduMap-Desktop_Qt_5_6_0_MSVC2015_64bit-Debug\debug\moc_mainwindow.obj
文件 15072 2017-01-13 01:31 28.BaiduMap\build-BaiduMap-Desktop_Qt_5_6_0_MSVC2015_64bit-Debug\debug\qwebchannel.js
文件 30331 2018-06-03 23:36 28.BaiduMap\build-BaiduMap-Desktop_Qt_5_6_0_MSVC2015_64bit-Debug\Makefile
文件 74375 2018-06-03 23:36 28.BaiduMap\build-BaiduMap-Desktop_Qt_5_6_0_MSVC2015_64bit-Debug\Makefile.Debug
文件 74414 2018-06-03 23:36 28.BaiduMap\build-BaiduMap-Desktop_Qt_5_6_0_MSVC2015_64bit-Debug\Makefile.Release
目录 0 2018-06-03 23:36 28.BaiduMap\build-BaiduMap-Desktop_Qt_5_6_0_MSVC2015_64bit-Debug\release\
文件 3312 2018-06-03 23:43 28.BaiduMap\build-BaiduMap-Desktop_Qt_5_6_0_MSVC2015_64bit-Debug\ui_mainwindow.h
- 上一篇:旅游网页模板
- 下一篇:QT 自定义无边框窗体,支持边缘拖拽缩放
评论
共有 条评论