'Is there some way to use html in qml as I need?
I want to place my text so i can get something like:
"SomeText1
SomeText2 One ...
two ...
three ..."
And I need to customize each of sometexts and 1,2,3 separately. So I use the code
Label{
...
textFormat: Text.RichText
text: <html><b><div style='font-size: 12pt;'> SomeText1</div></b></html>+
<html><i><div style='font-size: 12pt;'> SomeText2</div></i></html>+
(here must be a function which back some big text)
...
}
This code works great except one thing... It acts like ".simplefield()" and just "eat" all 2+ spaces and doesn't allow to use "\n". What can I do to change this?
Solution 1:[1]
I found the solution of my problem. When I type:
"1
2
3"
I see "1 2 3", but actually it is "1\n2\n3". My html-ed label doesn't react to "\n". So I just added a function in my .cpp, which replaced "\n" with "br". Here is it
str.replace("\n","<br>");
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
