Allright, i'm trying to make a kind of messenger using qml. i have a textarea and a send button. when send button is clicked the text inside the textarea will be displayed somewhere on the screen. but any other changes in text area will change the context of label. i tried using createObject(...) but it didn't help. is there any other way for creating labels (or any other component) dynamically?
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import QtQuick.Controls.Material 2.1
ApplicationWindow {
visible: true
width: 640
height: 480
property var xPosition : 500
property var yPosition: 200
title: qsTr("server")
Rectangle{
width: parent.width
height: parent.height
Button{
id: sentButton
width: parent.width / 14
x: parent.height + 112
y: parent.width - 200
Material.accent: Material.Blue
Material.background: Material.DeepOrange
Text {
id: name
text: qsTr("Send")
color: "white"
x:parent.width / 4
y:parent.height / 4
}
onClicked: {
//add label with the context of textarea
}
}
Rectangle{
id:back
height: sentButton.height
width: parent.width - sentButton.width
x:0
y: 435
color: "white"
border.width: 0.5
TextArea{
id:search
placeholderText: qsTr("Search")
x:7
width: parent.width - 25
background: null
}
}
}
}
TextArea::appendto add text to yourTextArea? Can you show what should be insideonClicked, see minimal reproducible example - m7913dListModel), to which you add the content, which you then us to instantiate labels as delegates of e.g. aListView- derM