summaryrefslogtreecommitdiffstats
path: root/demos/declarative/contacts
diff options
context:
space:
mode:
authorIan Walters <ian.walters@nokia.com>2009-05-07 05:12:42 (GMT)
committerIan Walters <ian.walters@nokia.com>2009-05-07 05:12:42 (GMT)
commit73667e2618ecbd00f6496006fcfc3c56ac99be6d (patch)
treec4de6bc0a656f33ca98b5feaf7f8b9b4d0991284 /demos/declarative/contacts
parentfe13d7b9ac373e959b8c6346fd7ec783855979d6 (diff)
downloadQt-73667e2618ecbd00f6496006fcfc3c56ac99be6d.zip
Qt-73667e2618ecbd00f6496006fcfc3c56ac99be6d.tar.gz
Qt-73667e2618ecbd00f6496006fcfc3c56ac99be6d.tar.bz2
Use KeyProxy
Up and down keys should go to the list, text to the search bar. KeyProxy handles this by listing a set of items to attempt handling keys.
Diffstat (limited to 'demos/declarative/contacts')
-rw-r--r--demos/declarative/contacts/contacts.qml10
-rw-r--r--demos/declarative/contacts/contacts.sqlitebin86016 -> 86016 bytes
2 files changed, 7 insertions, 3 deletions
diff --git a/demos/declarative/contacts/contacts.qml b/demos/declarative/contacts/contacts.qml
index 879c616..ce5a2b5 100644
--- a/demos/declarative/contacts/contacts.qml
+++ b/demos/declarative/contacts/contacts.qml
@@ -18,7 +18,7 @@ Rect {
query: "SELECT recid, label, email, phone FROM contacts WHERE lower(label) LIKE lower(:searchTerm) ORDER BY label, recid"
bindings: SqlBind {
name: ":searchTerm"
- value: searchBar.text + '%'
+ value: '%' + searchBar.text + '%'
}
},
Component {
@@ -172,7 +172,7 @@ Rect {
clip: true
model: contactList
delegate: contactDelegate
- focus: contacts.mode != 'list'
+ focus: false
}
Contact {
id: newContactItem
@@ -206,7 +206,7 @@ Rect {
anchors.left: parent.left
anchors.right: parent.right
anchors.bottomMargin: 0
- focus: contacts.mode == 'list'
+ focus: false
SearchBar {
id: searchBar
anchors.fill: parent
@@ -233,6 +233,10 @@ Rect {
}
]
}
+ KeyProxy {
+ focus: true
+ targets: { contacts.mode == "list" ? [searchBarWrapper, contactListView] : [contactListView]}
+ }
states: [
State {
name: "editNewState"
diff --git a/demos/declarative/contacts/contacts.sqlite b/demos/declarative/contacts/contacts.sqlite
index 559cdf3..d33e0c7 100644
--- a/demos/declarative/contacts/contacts.sqlite
+++ b/demos/declarative/contacts/contacts.sqlite
Binary files differ