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 <lars.knoll@digia.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
Sarunas Valaskevicius 2014-02-09 18:44:25 +00:00 committed by The Qt Project
parent d5b0f1763f
commit 13040043b2

View File

@ -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) {