使用 Qt 5.15.14 - QtLocation 5.15 - QtPositioning 5.15
我的应用程序窗口左侧固定有一张地图。 当窗口大小调整为较小的高度时,地图会正确粘附到其锚点。但是,当窗口展开时,地图无法正常显示。
我应该如何解决这个问题?这是地图代码。
Map {
id: map
property real mapRadius: 25
readonly property real minZoom: 6.0
readonly property real maxZoom: 17.0
readonly property var centerCoordinates: QtPositioning.coordinate(41.9027835, 12.4963655)
width: 500
height: 500
minimumZoomLevel: map.minZoom
maximumZoomLevel: map.maxZoom
center: map.centerCoordinates
zoomLevel: (map.minZoom+map.maxZoom)/2
plugin: Plugin {
name: "osm"
PluginParameter { name: "osm.mapping.highdpi_tiles"; value: "true" }
}
...
}
这是地图声明
GSMap {
id: gasStationMap
width: height
anchors {
top: parent.top; topMargin: 20
bottom: parent.bottom; bottomMargin: 20
left: parent.left; leftMargin: 20
}
}
谢谢! :)
这听起来很疯狂......但不将地图的宽度与其高度联系起来就足以使灰色条消失!
GSMap {
id: gasStationMap
width: parent.width*0.70
anchors {
top: parent.top; topMargin: 25
bottom: parent.bottom; bottomMargin: 25
left: parent.left; leftMargin: 25
}
}