Reputation: 479
I have a QML TextField
in Qt creator. I want to get the text from the textfield UI.
How do I do that?
Upvotes: 2
Views: 5257
Reputation: 7687
You need to have 'named' your TextField
s with id
s. If an object has an id
, you can use it as a handle to access properties from it. For example, imagine you want to clone the text from one textfield to another:
TextField {
id: textField1
text: "Text"
}
TextField {
id: textField2
text: textField1.text
}
You can find more detail here.
Upvotes: 6