Skip to content

Instantly share code, notes, and snippets.

@tadzik
Created February 14, 2015 12:29
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/7eea90dfd758176868ff to your computer and use it in GitHub Desktop.
Save tadzik/7eea90dfd758176868ff to your computer and use it in GitHub Desktop.
import QtQuick 2.0
import Sailfish.Silica 1.0
import harbour.dndhelper.spells 0.1
Page {
id: spellList
SilicaListView {
id: listView
anchors.fill: parent
header: SearchField {
id: searchField
width: listView.width
placeholderText: "Search"
onTextChanged: {
console.log("Text is now" + searchField.text)
spells.search(searchField.text)
}
}
// prevent newly added list delegates from stealing focus away from the search field
//currentIndex: -1
model: spells
delegate: Item {
height: Theme.itemSizeSmall
width: parent.width
Label { text: name }
MouseArea {
anchors.fill: parent
onClicked: {
pageStack.push(Qt.resolvedUrl("SpellDetails.qml"), {"spellFullText": full_text})
}
}
}
}
Spells {
id: spells
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment