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. Embedding hidden information in a QTextDocument
Forum Updated to NodeBB v4.3 + New Features

Embedding hidden information in a QTextDocument

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

    I need to add hidden information to a document. More specifically, the user should be able to add certain text blocks that contain specific information that can be changed and updated later on. A good example would be the current date or a multi-lingual text block (which displays a specific information in the currently selected language).

    I have found a similar question here:
    "Hidden information in a QTextDocument":http://qt-project.org/forums/viewthread/3428

    The last post was particularly interesting:

    [quote author="Volker" date="1296040209"]There are no means to leave comments or hidden text in a text document. You would have to subclass QTextDocument and/or QTextEdit an put that information into the output generated by that manually. You will have to parse it out of a to-be-set document manually too, as QTextDocument discards all data it is not supposed to use (ie. feeding your manually crafted text into a regular QTextDocument "cleans" out all the added data).[/quote]

    Now I found that the supported HTML subset includes the "meta" tag, which sounds exactly like what I need. But it seems that even this supported tag is scrubbed when setting the html to the text document.

    As for subclassing QTextDocument: The destructor is not virtual. Not good for subclassing.

    Any ideas?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      [quote author="Asperamanca" date="1341996951"]As for subclassing QTextDocument: The destructor is not virtual. Not good for subclassing.

      Any ideas?[/quote]

      At least on this issue: the destructor is virtual. QTextDocument is a [[doc:QObject]], and QObject has a virtual destructor. So, no issues there. I don't know enough about QTextDocument to comment on your actual question, sorry.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Asperamanca
        wrote on last edited by
        #3

        My fault, I looked up the destructor for QTextDocument without checking the base class.

        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