From 13040043b2f2274de74c296ede7dd3e6ffb67dcb Mon Sep 17 00:00:00 2001 From: Sarunas Valaskevicius Date: Sun, 9 Feb 2014 18:44:25 +0000 Subject: [PATCH] Emit updateBlock signal in QTextDocumentLayout updateBlock is part of the interface of QAbstractTextDocumentLayout however QTextDocumentLayout implementation is not invoking it. This commit adds similar behavior to QTextDocumentLayout as the QPlainTextDocumentLayout (QtWidgets) has by implementing the missing functionality. [ChangeLog][QtGui][QTextDocumentLayout] Emit updateBlock signal in QTextDocumentLayout. Task-number: QTBUG-36743 Change-Id: I7f812d4d5d7c2148393ee672fb0db6c0b2e73783 Reviewed-by: Lars Knoll Reviewed-by: Konstantin Ritt --- src/gui/text/qtextdocumentlayout.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index 313700429c6..b2c82b8654d 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -2883,11 +2883,11 @@ void QTextDocumentLayout::documentChanged(int from, int oldLength, int length) { Q_D(QTextDocumentLayout); - QTextBlock blockIt = document()->findBlock(from); + QTextBlock startIt = document()->findBlock(from); QTextBlock endIt = document()->findBlock(qMax(0, from + length - 1)); if (endIt.isValid()) endIt = endIt.next(); - for (; blockIt.isValid() && blockIt != endIt; blockIt = blockIt.next()) + for (QTextBlock blockIt = startIt; blockIt.isValid() && blockIt != endIt; blockIt = blockIt.next()) blockIt.clearLayout(); if (d->docPrivate->pageSize.isNull()) @@ -2929,6 +2929,9 @@ void QTextDocumentLayout::documentChanged(int from, int oldLength, int length) d->insideDocumentChange = false; + for (QTextBlock blockIt = startIt; blockIt.isValid() && blockIt != endIt; blockIt = blockIt.next()) + emit updateBlock(blockIt); + if (d->showLayoutProgress) { const QSizeF newSize = dynamicDocumentSize(); if (newSize != d->lastReportedSize) {