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