1、下载docker
2、在Kitematic里搜索安装 openmaptiles-server
3、qml 代码
import QtQuick 2.0
import QtQuick.Window 2.0
import QtLocation 5.6
import QtPositioning 5.6
Window {
width: 1024
height: 768
visible: true
Plugin {
id: mapPlugin
name: "osm"
//provide the address of the tile server to the plugin
PluginParameter {
name: "osm.mapping.custom.host"
value: "http://localhost:32769/styles/osm-bright/"
}
/*disable retrieval of the providers information from the remote repository.
If this parameter is not set to true (as shown here), then while offline,
network errors will be generated at run time*/
PluginParameter {
name: "osm.mapping.providersrepository.disabled"
value: true
}
}
Map {
id: map
width: 1024
activeMapType: supportedMapTypes[6]
height: 768
plugin: mapPlugin
center: QtPositioning.coordinate(40.91, 111.75)
zoomLevel: 10
}
}