From 6d4ad45c84279d808291793c36b795c2409935ff Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Wed, 18 Jan 2012 16:49:12 +0100 Subject: [PATCH] ensure the text field has focus --- .../platformcomponents/touch/Dialog.qml | 4 ---- .../plasmacomponents/qml/SelectionDialog.qml | 16 ++++++++++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/declarativeimports/plasmacomponents/platformcomponents/touch/Dialog.qml b/declarativeimports/plasmacomponents/platformcomponents/touch/Dialog.qml index 9e9fc8d90..e590f7ce7 100644 --- a/declarativeimports/plasmacomponents/platformcomponents/touch/Dialog.qml +++ b/declarativeimports/plasmacomponents/platformcomponents/touch/Dialog.qml @@ -168,10 +168,6 @@ Item { } } - Component.onCompleted: { - rootItem = Utils.rootObject() - } - states: [ State { name: "closed" diff --git a/declarativeimports/plasmacomponents/qml/SelectionDialog.qml b/declarativeimports/plasmacomponents/qml/SelectionDialog.qml index 6eddf2d3c..9b0d122e4 100644 --- a/declarativeimports/plasmacomponents/qml/SelectionDialog.qml +++ b/declarativeimports/plasmacomponents/qml/SelectionDialog.qml @@ -167,15 +167,27 @@ CommonDialog { reject() } + Timer { + id: focusTimer + interval: 100 + onTriggered: { + filterField.forceActiveFocus() + } + } onStatusChanged: { + //FIXME: why needs focus deactivation then activation? + if (status == DialogStatus.Open) { + filterField.focus = false + focusTimer.running = true + } + if (status == DialogStatus.Opening) { if (listView.currentItem != null) { listView.currentItem.focus = false } listView.currentIndex = -1 listView.positionViewAtIndex(0, ListView.Beginning) - } - else if (status == DialogStatus.Open) { + } else if (status == DialogStatus.Open) { listView.focus = true } }