Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Solved] Display XML new line <br/>
Forum Updated to NodeBB v4.3 + New Features

[Solved] Display XML new line <br/>

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 2.1k Views 1 Watching
  • 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
    eMixam
    wrote on last edited by
    #1

    Hello there,

    I have difficulties displaying a text that I get from a XmlListModel in a zone (sent when clicked on a ListView Item).
    The text appears without new lines.

    I basically do something like this:
    @function changeDescription(newDesc)
    {
    descText.text = "<b>Description:</b> " + newDesc
    }@

    I tried to change the textFormat or even replacing the "<br/>" with "<br>" as it works on another string (but using "\n" didn't improve either):
    @ var newLineStr = newDesc.toString().replace("<br/>", "<br>")@

    When I'm looking at the string in console, the new lines appear.

    Any help would be appreciated.

    1 Reply Last reply
    0
    • E Offline
      E Offline
      eMixam
      wrote on last edited by
      #2

      Little correction : when looking at the strings in console, new lines do not appear but if I copy-paste the content of the console and put it in an editor like Notepad++ they do appear as "CR LF".

      Looks like it isn't as trivial as I thought if no one can help...

      Should I report a bug, seems like I'm not the only one that encountered this issue :
      http://www.qtcentre.org/threads/44314-a-way-to-display-xml-node-value-with-new-line-(-lt-br-gt-)

      EDIT : putting the text in the XML file in <![CDATA[ TEXT<br/>TEXT]]> worked

      1 Reply Last reply
      0

      • Login

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