navigazione centralizzata in Page.openDetail (pageStack non visibile nei delegate)
This commit is contained in:
+11
-6
@@ -112,8 +112,7 @@ Page {
|
||||
}
|
||||
onClicked: {
|
||||
console.log("[tide] open port:", model.name, "custom:", model.custom)
|
||||
pageStack.push(Qt.resolvedUrl("DetailPage.qml"),
|
||||
{ port: model.port, portIndex: model.realIndex, custom: model.custom })
|
||||
page.openDetail(model.port, model.realIndex, model.custom)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,6 +148,14 @@ Page {
|
||||
}
|
||||
}
|
||||
|
||||
// Navigazione centralizzata: pageStack si risolve solo nel contesto del
|
||||
// Page (nei delegate della lista non è visibile su questo kit).
|
||||
function openDetail(port, portIndex, custom) {
|
||||
console.log("[tide] openDetail:", port[0], "custom:", custom)
|
||||
pageStack.push(Qt.resolvedUrl("DetailPage.qml"),
|
||||
{ port: port, portIndex: portIndex, custom: custom })
|
||||
}
|
||||
|
||||
// --- Ricerca libera (geocoding) ---
|
||||
function geoFail(msg) {
|
||||
geoMsg.text = msg || qsTr("City not found (offline and not in local dataset).")
|
||||
@@ -175,8 +182,7 @@ Page {
|
||||
geoMsg.visible = true
|
||||
geoMsg.color = Theme.highlightColor
|
||||
try {
|
||||
pageStack.push(Qt.resolvedUrl("DetailPage.qml"),
|
||||
{ port: port, portIndex: -1, custom: true })
|
||||
page.openDetail(port, -1, true)
|
||||
} catch (e) {
|
||||
console.log("[tide] push DetailPage failed:", e)
|
||||
geoFail(qsTr("Could not open the detail page: %1").arg(e))
|
||||
@@ -254,8 +260,7 @@ Page {
|
||||
if (pref !== "") {
|
||||
for (var i = 0; i < Tides.PORTS.length; i++) {
|
||||
if (Tides.PORTS[i][0] === pref) {
|
||||
pageStack.push(Qt.resolvedUrl("DetailPage.qml"),
|
||||
{ port: Tides.PORTS[i], portIndex: i, custom: false })
|
||||
page.openDetail(Tides.PORTS[i], i, false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user