feat(ui/modules/Common/Form/Fields/TextField): set cursor position to 0 at end edition

This commit is contained in:
Ronan Abhamon 2017-05-15 16:11:08 +02:00
parent c65a5b5fd4
commit f6f32adf97

View file

@ -11,10 +11,14 @@ import Common.Styles 1.0
Controls.TextField {
id: textField
// ---------------------------------------------------------------------------
property alias icon: icon.icon
property string error: ''
property var tools
// ---------------------------------------------------------------------------
background: Rectangle {
border {
color: textField.error.length > 0
@ -60,6 +64,18 @@ Controls.TextField {
rightPadding: TextFieldStyle.text.rightPadding + toolsContainer.width
selectByMouse: true
// ---------------------------------------------------------------------------
onEditingFinished: cursorPosition = 0
onTextChanged: {
if (!focus) {
cursorPosition = 0
}
}
// ---------------------------------------------------------------------------
Icon {
id: icon