Unsolved Wrong text format in QTextEdit after setHtml is called
-
This post is deleted! -
Have you changed the wrap mode?
-
Yes I've tried all possible ways using setWordWrapMode and setLineWrapMode, but still no effect...
-
Does the HTML specify custom style, or
<pre>
element? It may be disabling Qt's own handling of strings.Plus, have you verified that only tags supported by Qt are used? Qt RichText supports only a limited subset of HTML.
-
Well the only tags that are used are: <span style...>, <br> and   .. that's all tags I use.
U can see the html, I've posted a link (https://drive.google.com/open?id=1ZIPjzXgAgEFci5O1zZ20DhQ-OFxqqKYf) -
@juanti Hi, I've tried that if you replace all the " " in your html with real spaces, the text will wrap as you expecting.
-
@Bonnie , yes but there are times where I have 2 or more addition spaces, and if I don't replace the spaces with " ", they get destroyed to one.
-
-
@juanti said in Wrong text format in QTextEdit after setHtml is called:
 
Thanks guys. I found a solution for the problem. So just add <pre> tag at the begining and the end of the html and replace nbsp with " " and it would work.Thanks everyone !