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