Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qml Text new line

If I enter: "Subject:" + "/n" + vak + "/n" + klas as the text property of a Text element it returns everything in a straight line with "/n"'s in.

How can I get it to create new lines?

like image 628
Gerharddc Avatar asked May 19 '12 14:05

Gerharddc


People also ask

How do you wrap text in QML?

By default, Text will display the text as a single line unless it contains embedded newlines. To wrap the line, set the wrapMode property and give the text an explicit width for it to wrap to.

What is text in QML?

Text { text: "<b>Hello</b> <i>World!</ i>" } If height and width are not explicitly set, Text will attempt to determine how much room is needed and set it accordingly. Unless wrapMode is set, it will always prefer width to height (all text will be placed on a single line).


2 Answers

I don't know qt or qml, but in most languages the escape character is a backslash, not a regular slash, so the escape sequence would be \n for a newline

like image 91
keyser Avatar answered Sep 19 '22 10:09

keyser


Enter the text as "Hello \n World" it works

like image 23
Ankit Avatar answered Sep 19 '22 10:09

Ankit