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. QTextView changes the HTML string
QtWS25 Last Chance

QTextView changes the HTML string

Scheduled Pinned Locked Moved Unsolved General and Desktop
html
7 Posts 3 Posters 1.7k 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.
  • M Offline
    M Offline
    moravas
    wrote on last edited by
    #1

    Hi Folks,

    I have a HTML producer module. The provided HTML contains lots of "metadata", like HTML class informations and more grouped into <span> tag. When I display this HTML in QTextEdit trough setHtml() then I acquire it back via toHtml(), these informations gone away.
    Can anybody help me, how can I avoid it? Can it turn off or something else?

    Regards,
    Norbert

    m.sueM raven-worxR 2 Replies Last reply
    0
    • M moravas

      Hi Folks,

      I have a HTML producer module. The provided HTML contains lots of "metadata", like HTML class informations and more grouped into <span> tag. When I display this HTML in QTextEdit trough setHtml() then I acquire it back via toHtml(), these informations gone away.
      Can anybody help me, how can I avoid it? Can it turn off or something else?

      Regards,
      Norbert

      m.sueM Offline
      m.sueM Offline
      m.sue
      wrote on last edited by
      #2

      @moravas: or something else?

      Keep the HTML contents in a QString variable :-)

      1 Reply Last reply
      0
      • M Offline
        M Offline
        moravas
        wrote on last edited by
        #3

        Thank you!

        I checked this idea, but what about when the user edit the content? I have to track it.

        1 Reply Last reply
        0
        • m.sueM Offline
          m.sueM Offline
          m.sue
          wrote on last edited by m.sue
          #4

          Yes, I only thought about the display, sorry. Then you will really need a way to switch it off.
          Are the vanishing data outside of the <body> tag? Then it would probably be easy to keep track.
          -Michael.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            moravas
            wrote on last edited by moravas
            #5

            Hi,

            no, it is inside the body. Mainly, these data is class tags belongs to each word, like:

            <span class="meta word info">Hello</span> <span class="other meta word info">Word</span>
            

            while acquiring back the HTML seems like this:

            <span name="1">Hello</span> <span name="2">Word</span>
            

            so my original informations have been lost.

            Regards,
            Norbert

            1 Reply Last reply
            0
            • m.sueM Offline
              m.sueM Offline
              m.sue
              wrote on last edited by m.sue
              #6

              Did you try the QTextBrowser class? The name sounds more promising in this context. Oops, no, its not editable!
              You will then probably have to use the QtWebEngine module. I do not have experience with it. Maybe someone else can tell you more.
              -Michael.

              1 Reply Last reply
              0
              • M moravas

                Hi Folks,

                I have a HTML producer module. The provided HTML contains lots of "metadata", like HTML class informations and more grouped into <span> tag. When I display this HTML in QTextEdit trough setHtml() then I acquire it back via toHtml(), these informations gone away.
                Can anybody help me, how can I avoid it? Can it turn off or something else?

                Regards,
                Norbert

                raven-worxR Offline
                raven-worxR Offline
                raven-worx
                Moderators
                wrote on last edited by raven-worx
                #7

                @moravas
                QTextEdit and buddies only support rich-text and are not suitable for full HTML editing.
                You should use either QtWebkit module or QtWebEngine (depending on the Qt version you are using) and set the contents editable.
                But at least QtWebkit (and i guess also QtWebEngine) changes the content a little bit, but the HTML stays valid all the time at least.

                --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                If you have a question please use the forum so others can benefit from the solution in the future

                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