I have a Label, but it should only be as long as the form. If the label is longer it should start on a new line. How can I realize this? I am using QtQuick Controls 2.0
My current code for the Label:
Label {
id: lblMsg
width: ApplicationWindow.width - 10 // not working
text: "ajksdlldjklasdasdasdasdasdasdasdasdasdasdasdasdasdasdasd"
x: 20
y: 20
}
add this line:
wrapMode: Text.Wrap
Use the wrapMode
property:
Label {
id: lblMsg
width: ApplicationWindow.width - 10
text: "ajksdlldjklasdasdasdasdasdasdasdasdasdasdasdasdasdasdasd"
x: 20
y: 20
wrapMode: Label.WordWrap
}
I'd suggest using Qt Quick Layouts to manage the layout of your application instead of sizing items manually.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With