Hidden information in a QTextDocument
Hello, I need to embed some information in a QTextDocument but it has to be hidden. A QTextEdit doesn’t have to show that information but it is only for my program purpose.
I saw there are MetaInformation but there are only two values, url and title. I need more and different values.
I think to make a fragment or a block hidden but I fear that user can edit above it or change its position so I can’t get it anymore.
Has someone some suggest form me?
Best Regards
Willy
6 replies
Maybe you can create your own class that inherits QTextDocument, something like this:
- Q_OBJECT
- public:
- private:
- QString info;
- };
You could just create a class that inherit QTextDocument, then use it. In your sub class just add a QString and do what you want with it.
Another solution on your subclass is to play with http://doc.trolltech.com/4.6.2/qobject.html#Q_PROPERTY and other Q_… macro.
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).
You must log in to post a reply. Not a member yet? Register here!



