[SailfishDevel] TextField.forceActiveFocus() works only every second time

Michael Fuchs michfu at gmx.at
Thu Jun 22 09:09:51 UTC 2017


Hi Guys,

I got a textinput (e.g. TextField) in which the text gets manipulated by 
pushing a button. After the manipulation the input should get back 
focus. I'm trying it like this:

Button {
     x: Theme.horizontalPageMargin
     text: qsTr("Hello Sailors")
     onClicked: {
         ta.text += "hello"
         ta.forceActiveFocus()
     }
}
TextField {
     id: ta
     text: "test"
     focus: true
}

But it only works every second time. How could I workaround this?

Thanks,
Michael.


More information about the Devel mailing list