Il 11/11/18 17:15, coroberti . ha scritto:
Following Allan's advise, here's something that is starting to work
(checks omitted)

QTextDocument* doc = this->text_edit_->document();
QTextBlock currentBlock = doc->firstBlock();

     while (currentBlock.isValid()) {

         QTextCursor cursor(currentBlock);
         QTextBlockFormat blockFormat = currentBlock.blockFormat();
         blockFormat.setLineHeight(200, QTextBlockFormat::ProportionalHeight);
         cursor.setBlockFormat(blockFormat);

         currentBlock = currentBlock.next();
     }

Thank you very much!

Isn't it simpler to use a selection approach instead?

QTextBlockFormat format;
format.setLineHeight(...);

QTextCursor cursor(textDocument);
cursor.select(QTextCursor::Document);
cursor.mergeBlockFormat(format);


My 2 c,

--
Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

Attachment: smime.p7s
Description: Firma crittografica S/MIME

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to