ensure the text field has focus

This commit is contained in:
Marco Martin 2012-01-18 16:49:12 +01:00
parent 7a656708fe
commit 6d4ad45c84
2 changed files with 14 additions and 6 deletions

View File

@ -168,10 +168,6 @@ Item {
}
}
Component.onCompleted: {
rootItem = Utils.rootObject()
}
states: [
State {
name: "closed"

View File

@ -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
}
}