Defining the element to focus when a text field is completed
-
Some weeks ago I decided to use com.nokia.meego's "TextField":http://harmattan-dev.nokia.com/docs/library/html/qt-components/qt-components-meego-textfield.html?tab=1 element instead of Qt upstream "TextInput":http://doc.qt.nokia.com/4.7-snapshot/qml-textinput.html because the former had a convenient placeholderText property. Now someone had the good idea of jumping to the next text field when the user presses the Enter key. I see TextInput has a "onAccepted":http://doc.qt.nokia.com/4.7-snapshot/qml-textinput.html#onAccepted-signal signal to do just that, but this seems to be missing in TextField...
Any suggestions on how to jump to the next field with a TextField. Advice on how to get placeholderText in a TextInput might be also useful. ;) Thanks!
-
Hi there Qgil,
I came across that problem a few days ago too :D.
@
TextField {
id: myField
placeholderText: "Placeholder..."//... Keys.onReturnPressed: { console.log("Enter pressed") settingsSheet.accept()//a parent settings sheet for example //or you could just set the next field's focus }
}
@I found the solution at QmlComponentGallery's "TextInputPage.qml" source file. That file's the best documentation for this sort of thing :D