This commit is contained in:
Ronan Abhamon 2016-12-08 12:22:56 +01:00
parent 507f8066e9
commit 93c88e8a09
4 changed files with 11 additions and 9 deletions

View file

@ -112,10 +112,11 @@ RowLayout {
implicitHeight: textEdit.height
width: parent.width
TextEdit {
TextEdit {
id: textEdit
text: $value
width: 300
height: ListFormStyle.lineHeight
onEditingFinished: _handleEditionFinished(index, text)

View file

@ -11,13 +11,13 @@ Item {
property alias font: textEdit.font
property alias color: textEdit.color
signal editionFinished
signal editingFinished
// -----------------------------------------------------------------
function _handleEditionFinished () {
function _handleEditingFinished () {
textEdit.cursorPosition = 0
editionFinished()
editingFinished()
}
// -----------------------------------------------------------------
@ -66,7 +66,6 @@ Item {
color: activeFocus && !readOnly
? TextEditStyle.textColor.focused
: TextEditStyle.textColor.normal
padding: ListFormStyle.value.text.padding
selectByMouse: true
width: flick.width
wrapMode: Text.Wrap
@ -75,7 +74,7 @@ Item {
Keys.onReturnPressed: focus = false
onCursorRectangleChanged: flick._ensureVisible(cursorRectangle)
onEditingFinished: _handleEditionFinished()
onEditingFinished: _handleEditingFinished()
}
}
}

View file

@ -5,16 +5,16 @@ import Common.Styles 1.0
// ===================================================================
TextEdit {
TextInput {
id: textEdit
clip: true
color: activeFocus && !readOnly
? TextEditStyle.textColor.focused
: TextEditStyle.textColor.normal
padding: ListFormStyle.value.text.padding
selectByMouse: true
verticalAlignment: TextEdit.AlignVCenter
wrapMode: Text.Wrap
Keys.onEscapePressed: focus = false
Keys.onReturnPressed: focus = false

View file

@ -111,8 +111,10 @@ ColumnLayout {
text: avatar.username
onEditionFinished: {
onEditingFinished: {
_contact.username = text
// Update current text with new username.
text = _contact.username
}
}