Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] QTextDocument with < and > characters

[Solved] QTextDocument with < and > characters

Scheduled Pinned Locked Moved General and Desktop
qtextdocumenthtml
2 Posts 2 Posters 1.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Endless77
    wrote on 23 Jul 2015, 16:34 last edited by Endless77
    #1

    I'm using QTextDocument to set the appearance of fields. I use:

    htmlText.setHtml("<div align=center>mytext</div>

    When mytext is composed of numerals and normal characters, everything is fine, but in one case I'd like to display the string "<80" in the field. This doesn't work (I would assume because the parser sees the < character and figures it's a new section). How can I include the < or > characters in an html string?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on 23 Jul 2015, 18:34 last edited by Chris Kawa
      #2

      < and > are special characters in html. To display them literally you can use entities: &lt; and &gt; i.e. &lt;80 will result in <80.
      For a list of possible entities you can scout the web, e.g. here.

      1 Reply Last reply
      0

      2/2

      23 Jul 2015, 18:34

      • Login

      • Login or register to search.
      2 out of 2
      • First post
        2/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved