qt - QML 地图调试
问题描述
我对minimum_map演示做了一些小的修改,以允许它使用离线图块。它在我的桌面上完美运行,但是当我在嵌入式目标上运行它时,它只加载一个空白的灰色屏幕。我假设我可能缺少嵌入式目标上的必需组件。它具有 QLocaiton 模块以及 OSM 插件。我得到的唯一错误信息qrc:/main.qml:87:24: Unable to assign [undefined] to QDeclarativeGeoMapType*
来自这一行activeMapType: supportedMapTypes[supportedMapTypes.length - 1]
。这是因为在嵌入式目标上,supportedMapTypes.length
返回 0。有人可以推荐一些关于如何调试它的想法。仅此错误消息很难。
import QtQuick 2.0
import QtQuick.Window 2.0
import QtLocation 5.6
import QtPositioning 5.6
Window {
width: 800
height: 480
visible: true
Plugin {
id: mapPlugin
name: "osm"
PluginParameter {
name: "osm.mapping.custom.host"
value: "file:///usr/bin/resources/maptiles/"
}
PluginParameter {
name: "osm.mapping.providersrepository.disabled"
value: true
}
PluginParameter {
name: "osm.mapping.cache.directory"
value: "/home/asdf/Documents/cache"
}
Component.onCompleted: {
console.log("Plugin loaded")
}
}
Map {
anchors.fill: parent
plugin: mapPlugin
zoomLevel: 7
activeMapType: supportedMapTypes[supportedMapTypes.length - 1]
Component.onCompleted: {
for( var i = 0; i < supportedMapTypes.length; i++) {
console.log(supportedMapTypes[i].name)
}
console.log("Map loaded")
}
}
}
解决方案
推荐阅读
- r - 将字符转换为日期和数字,保持相同的格式
- mysql - 数据库,每个用户一张表还是一张大表?
- python - Python:复杂的迭代
- python - 在 Sage 中将数字列表转换为 q-ary 表示
- sql - 为什么 EXEC sp_sqlexec @strSQL 与 EXECUTE (PRINT @strSQL) 不同
- r - 根据最小距离将点分配给组
- vbscript - 如何在 VBScript 中使用 %username%
- python - TypeError: unsupported operand type(s) for *: 'function' and 'int' in Python, 无法计算解决方案
- python - 令牌身份验证在 Django Rest 框架上不起作用
- excel - Excel VBA - 复制数组中的单元格并粘贴到下一个空单元格