Skip to content

Instantly share code, notes, and snippets.

@tadzik
Created February 14, 2015 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tadzik/4740b52d96eb5afb5a09 to your computer and use it in GitHub Desktop.
Save tadzik/4740b52d96eb5afb5a09 to your computer and use it in GitHub Desktop.
SilicaListView {
id: listView
anchors.fill: parent
header: SearchField {
id: searchField
width: parent.width
placeholderText: "Search"
onTextChanged: {
listView.model = spells.search(searchField.text)
}
}
// prevent newly added list delegates from stealing focus away from the search field
currentIndex: -1
model: { spells.search("") }
delegate: Item {
height: Theme.itemSizeSmall
width: parent.width
Label { text: modelData }
MouseArea {
anchors.fill: parent
onClicked: {
var text = spells.getFullText(modelData)
pageStack.push(Qt.resolvedUrl("SpellDetails.qml"), {"spellFullText": text})
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment