Button height with '\n' character
Unsolved
QML and Qt Quick
-
Hi all,
this probably is a very silly question but ATM I can't find solution.
I have the following Button:Button { text: "aaaa\nbbbb" anchors.top: parent.top anchors.margins: 15 width: parent.width }
the Button's height doesn't consider the new line so part of the text is cuts.
I could force height by hand in pixel but I'd prefer to let Button to find it's natural height.Thanks
Luca
-
Hi Luca,
try this. Hope this is what u want.
Button { id: button1 width: 50 height: labelText.height anchors.bottom: parent.bottom anchors.right: parent.right style: ButtonStyle { background: Rectangle { color: "red" /// Give a proper BG color. } label: Text{ id: labelText text: "Aaaaaaaa Bbbbbbbb Ccccccc" wrapMode: Text.WordWrap } } }
Regards,
Rajeesh Raveendran