How to use font color in Qstring
-
Hi,
I have a string which i need to update with different fonts. Following is the value in Qstring on starting
QString a = "displayName1(sip:abc@proxy.com), displayname2(sip:xyz@proxy.com)".Later it get updated as follows with "connected" shown in red font:
"displayName1(sip:abc@proxy.com) - connected, displayname2(sip:xyz@proxy.com) - connected".
I was using QString text(tr(" - <FONT COLOR=red>Connected</FONT>")); for addeing connected in bewteen the string
Till here it was working fine.
But now i changed the string to
QString a = "displayName1sip:abc@proxy.com, displayname2sip:xyz@proxy.com". And added connected in between the string.But now its shown as
"displayName1sip:abc@proxy.com - <FONT COLOR=red>Connected</FONT>, displayname2sip:xyz@proxy.com - <FONT COLOR=red>Connected</FONT>".Somehow the problem started when i start using "<>" in string other then font color change. Can someone please explain me what I am doing wrong and how to correct this problem.
Thanks,
Prankur -
Hi,
Using <> like that you are creating an opening tag with no ending so you are creating an invalid html document. You have to escape this character if you want to use it "as is"
-
Shouldn't there be <html> and </html> as well?
-
IIRC, no. Maybe using the terms "html document" is not the best description. You can do rich text with QLabel but it's not a browser.