我想在标签上显示最近输入的文本。这是qml的代码:
Container {
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Top
topPadding: 100
leftPadding: 50
rightPadding: leftPadding
/*TextArea {
id: taComment
preferredHeight: 270
editable: quoteBubble.editMode
enabled: enableSave
input.flags: TextInputFlag.SpellCheckOff
}*/
Label {
verticalAlignment: VerticalAlignment.Top
horizontalAlignment: HorizontalAlignment.Center
text: cppObj.desc
}
}
Container {
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Bottom
leftPadding: 50
rightPadding: leftPadding
bottomPadding: 40
TextField {
id: tfComment
hintText: qsTr("add comment")
inputMode: TextFieldInputMode.Text
input {
submitKey: SubmitKey.Submit
onSubmitted: {
cppObj.onCommentSubmitClicked(tfComment.text, "");
}
}
}
}
}
因此,当用户从第一个文本字段输入一个短语时,我希望该短语显示在它下面的标签中。更像是短信。我怎么做?在将输入的文本从文本字段显示到标签后,我想保存标签的文本,所以当我输入新评论时,它将被保存到其他标签