I want to display the recently entered text to the label. Here's the code for the 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, "");
}
}
}
}
}
So when the user enters a phrase from the first textfield, I want that phrase to display in the label below it. More like a text messaging. How do I do that? And after displaying the entered text from textfield to label I want to save the label's text, so when I enter new comment it'll be saved to other label
Add id to Label like following
Label {
id: label
....
}
Then on TextField on submit handler, you can get text from textField and set it to label, like below
onSubmitted: {
label.text = tfComment.text;
}