fix ReferenceError: campi ricerca fuori dall'header della lista (scope chiuso)
This commit is contained in:
+20
-11
@@ -7,13 +7,13 @@ Page {
|
||||
|
||||
property var customPorts: [] // porti creati dalla ricerca libera (sessione)
|
||||
|
||||
SilicaListView {
|
||||
id: list
|
||||
anchors.fill: parent
|
||||
model: ListModel { id: portModel }
|
||||
|
||||
header: Column {
|
||||
// Campi di ricerca FUORI dal header della lista: gli id dichiarati nel
|
||||
// componente header hanno scope chiuso e le funzioni del Page non li
|
||||
// vedono (ReferenceError "filter is not defined").
|
||||
Column {
|
||||
id: topCol
|
||||
width: parent.width
|
||||
|
||||
PageHeader { title: "Tide" }
|
||||
|
||||
SearchField {
|
||||
@@ -48,10 +48,18 @@ Page {
|
||||
color: Theme.errorColor
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
SectionHeader { text: qsTr("Ports") }
|
||||
}
|
||||
|
||||
SilicaListView {
|
||||
id: list
|
||||
anchors.top: topCol.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
model: ListModel { id: portModel }
|
||||
|
||||
header: SectionHeader { text: qsTr("Ports") }
|
||||
|
||||
delegate: ListItem {
|
||||
contentHeight: Theme.itemSizeMedium
|
||||
highlighted: model.isPreferred
|
||||
@@ -84,7 +92,7 @@ Page {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
onClicked: {
|
||||
pageStack.push(Qt.resolvedUrl("DetailPage.qml"),
|
||||
page.pageStack.push(Qt.resolvedUrl("DetailPage.qml"),
|
||||
{ port: model.port, portIndex: model.realIndex, custom: model.custom })
|
||||
}
|
||||
}
|
||||
@@ -125,6 +133,7 @@ Page {
|
||||
function geoFail() {
|
||||
geoMsg.text = qsTr("City not found (offline and not in local dataset).")
|
||||
geoMsg.visible = true
|
||||
geoMsg.color = Theme.errorColor
|
||||
}
|
||||
|
||||
function geoFound(name, lat, lon, src) {
|
||||
@@ -144,7 +153,7 @@ Page {
|
||||
geoMsg.text = qsTr("Found %1 (via %2)").arg(name).arg(src)
|
||||
geoMsg.visible = true
|
||||
geoMsg.color = Theme.highlightColor
|
||||
pageStack.push(Qt.resolvedUrl("DetailPage.qml"),
|
||||
page.pageStack.push(Qt.resolvedUrl("DetailPage.qml"),
|
||||
{ port: port, portIndex: -1, custom: true })
|
||||
}
|
||||
|
||||
@@ -199,7 +208,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"),
|
||||
page.pageStack.push(Qt.resolvedUrl("DetailPage.qml"),
|
||||
{ port: Tides.PORTS[i], portIndex: i, custom: false })
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user