DetailPage: guardie port undefined, log init/refresh, Z0 tratteggiata manuale (no setLineDash Qt5.6)

This commit is contained in:
2026-08-31 15:18:25 +02:00
parent 91fc25dd12
commit f38a677d46
+22 -5
View File
@@ -27,6 +27,11 @@ Page {
function init() {
nearPort = null
nearKm = 0
console.log("[tide] DetailPage.init custom:", custom, "port:", port ? port[0] : "UNDEFINED")
if (!port) {
console.log("[tide] DetailPage.init: port undefined, niente da caricare")
return
}
if (custom && port.length > 5 && port[5] !== "") {
var np = Tides.nearestPort(port[2], port[3])
if (np.port !== null) {
@@ -38,7 +43,12 @@ Page {
}
function refresh() {
if (!port) return
if (!port) {
console.log("[tide] refresh: port UNDEFINED")
return
}
console.log("[tide] refresh:", port[0], "days:", days, "unit:", unit)
try {
// eventi
eventsModel.clear()
var ex = Tides.extrema(port, new Date(), days)
@@ -68,6 +78,9 @@ Page {
curveInfo.text = qsTr("Z₀ %1 m · 7 harmonic constituents").arg(port[4][0].toFixed(2))
}
cv.requestPaint()
} catch (e) {
console.log("[tide] refresh error:", e)
}
}
property var moonNames: [
@@ -300,11 +313,15 @@ Page {
ctx.fillText((d.getHours() < 10 ? "0" : "") + d.getHours() + ":00", x + 3, h - 3)
}
// Z0 tratteggiata
ctx.setLineDash([4, 4])
// Z0 tratteggiata (disegno manuale: setLineDash non garantito su Qt 5.6)
ctx.strokeStyle = Theme.rgba(Theme.secondaryColor, 0.6)
ctx.beginPath(); ctx.moveTo(pad, Y(port[4][0])); ctx.lineTo(w - pad, Y(port[4][0])); ctx.stroke()
ctx.setLineDash([])
var zy = Y(port[4][0])
for (var zx = pad; zx < w - pad; zx += 10) {
ctx.beginPath()
ctx.moveTo(zx, zy)
ctx.lineTo(Math.min(zx + 5, w - pad), zy)
ctx.stroke()
}
// curva
ctx.strokeStyle = Theme.highlightColor