From e711ce99c8cafe2e7c1d81a20a280f3029c98ccb Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 29 Sep 2016 19:52:55 +0200 Subject: Gallery: make the drawer usable with keyboard Give it focus, and remove the check for the current index. It's a leftover from the days when Gallery used to replace the current page instead of doing a push. It looked silly to replace a page with the same page. This can no longer happen, because the drawer is not even accessible when navigated to a control page. And when navigating the drawer with keyboard, it is exactly the current item that must be triggered when you hit the spacebar. :) Change-Id: I00b48fbe4dd61b06041cb0c3370dfa9c12505dcf Reviewed-by: Mitch Curtis --- examples/quickcontrols2/gallery/gallery.qml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/quickcontrols2/gallery/gallery.qml') diff --git a/examples/quickcontrols2/gallery/gallery.qml b/examples/quickcontrols2/gallery/gallery.qml index 0d1c89f0..aadbcdec 100644 --- a/examples/quickcontrols2/gallery/gallery.qml +++ b/examples/quickcontrols2/gallery/gallery.qml @@ -135,6 +135,8 @@ ApplicationWindow { ListView { id: listView + + focus: true currentIndex: -1 anchors.fill: parent @@ -143,10 +145,8 @@ ApplicationWindow { text: model.title highlighted: ListView.isCurrentItem onClicked: { - if (listView.currentIndex != index) { - listView.currentIndex = index - stackView.push(model.source) - } + listView.currentIndex = index + stackView.push(model.source) drawer.close() } } -- cgit v1.2.3