qtserializationbinary-dataqtextdocumentqtextcursor

QTextDocument serialization


I read old topics about QTextDocument serialization: here and here. As I understood, once real method for serialization and deserializtion without additional code is saving and reading documents as html files. But, I think, this method not fast, because html string parsing is a hard and low time operation.

In other case, I can save document in binary format and deserialize them via QTextCursor methods calling in sequence, that faster then html parsing, I think.

Is exist code samples for QTextDocument binary serialization?


Solution

  • I didn't found a pure binary seraialization, but I found working sample for reading ODF format files to QTextDocument. This also string (xml) parsing method, but odf format accept avoid storaging several files for document, if him contains images.

    Source code can be viewed in okular git repo here