From 73667e2618ecbd00f6496006fcfc3c56ac99be6d Mon Sep 17 00:00:00 2001 From: Ian Walters Date: Thu, 7 May 2009 15:12:42 +1000 Subject: 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. --- demos/declarative/contacts/contacts.qml | 10 +++++++--- demos/declarative/contacts/contacts.sqlite | Bin 86016 -> 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 Binary files a/demos/declarative/contacts/contacts.sqlite and b/demos/declarative/contacts/contacts.sqlite differ -- cgit v0.12