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
Forum Updated to NodeBB v4.3 + New Features

QTextView changes the HTML string

Scheduled Pinned Locked Moved Unsolved General and Desktop
html
7 Posts 3 Posters 1.7k Views 2 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.
  • M Offline
    M Offline
    moravas
    wrote on 12 Jan 2017, 06:34 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 R 2 Replies Last reply 12 Jan 2017, 07:29
    0
    • M moravas
      12 Jan 2017, 06:34

      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 Offline
      M Offline
      m.sue
      wrote on 12 Jan 2017, 07:29 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 12 Jan 2017, 07:33 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 Offline
          M Offline
          m.sue
          wrote on 12 Jan 2017, 07:47 last edited by m.sue 1 Dec 2017, 07:47
          #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 12 Jan 2017, 08:34 last edited by moravas 1 Dec 2017, 08:35
            #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 Offline
              M Offline
              m.sue
              wrote on 12 Jan 2017, 08:37 last edited by m.sue 1 Dec 2017, 08:48
              #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
                12 Jan 2017, 06:34

                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

                R Offline
                R Offline
                raven-worx
                Moderators
                wrote on 12 Jan 2017, 08:41 last edited by raven-worx 1 Dec 2017, 08:41
                #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

                5/7

                12 Jan 2017, 08:34

                • Login

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