嘗試制作路由專案。路由是在街道網路中尋找從起點到終點的路徑的程序。您可以使用路由服務來查找路線、獲取行車路線、計算行車時間以及解決復雜的多車輛路由問題。
要創建路線,我通常會定義一組停靠點(起點和一個或多個目的地),并使用該服務查找帶有方向的路線。我還使用了一些額外的引數,例如障礙和旅行方式來優化結果。
在我的模型中,我想創建用于顯示路線方向的視窗,并想分別定義 android 和 ios 的平臺寬度。至于高度,我的兩個平臺都作業正常,但我不知道我該怎么做?有任何想法嗎。
下面是我要修改的代碼
// Create window for displaying the route directions
Rectangle {
id: directionWindow
anchors {
right: parent.right
top: parent.top
margins: 5
}
radius: 5
ListView {
id: directionsView
anchors {
fill: parent
margins: 5
}
header: Component {
Text {
height: 40
text: "Directions:"
font.pixelSize: 22
}
}
// set the model to the DirectionManeuverListModel returned from the route
model: model.directions
delegate: directionDelegate
}
}
Component {
id: directionDelegate
Rectangle {
id: rect
width: parent.width
height: textDirections.height
color: directionWindow.color
// separator for directions
Shape {
height: 2
ShapePath {
strokeWidth: 1
strokeColor: "darkgrey"
strokeStyle: ShapePath.SolidLine
startX: 20; startY: 0
PathLine { x: parent.width - 20 ; y: 0 }
}
}
Text {
id: textDirections
text: qsTr("%1 (%2 miles)".arg(directionText).arg((length * 0.00062137).toFixed(2)))
wrapMode: Text.WordWrap
anchors {
leftMargin: 5
left: parent.left
right: parent.right
}
}
}
}
uj5u.com熱心網友回復:
你可以像這樣定義你的螢屏寬度:
visible: model.directions
width: Qt.platform.os === "ios" || Qt.platform.os === "android" ? 250 : 350
height: parent.height / 2
color: "#FBFBFB"
clip: true
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/337948.html
標籤:qt 质量管理器 地理信息系统 arcgis-服务器 arcgis 运行时
下一篇:編輯和同步功能中的驗證
