Hi,

I am formatting a QTextDocument in a specific way, most notably I change the line high to +1 for the entire document, which is done like this:


Qt Code:
  1. QTextCursor cursor(document());
  2. do{
  3. block = cursor.blockFormat();
  4. block.setLineHeight(1, QTextBlockFormat::LineDistanceHeight);
  5. cursor.setBlockFormat(block);
  6. } while(cursor.movePosition(QTextCursor::NextBlock));
To copy to clipboard, switch view to plain text mode 


This has been identified as a major performance bottleneck (in particular the cursor.setBlockFormat call).

Since I am setting always the same thing for the entire document - surely there has to be a better way of setting the format/line spacing as a default for the entire document? Perhaps even before inserting the text?


Thanks for your help.