Respect the QTextBlock's character formats in itemization

This fixes regression introduced in f864bdaf59
(in resolveAdditionalFormats(), formatIndex(si) returned an invalid
block format index due to non-empty specialData->resolvedFormats)

Task-number: QTBUG-36759

Change-Id: I4da13d2edaf1987bcd85b2ef326e9d22345eb8f3
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
Konstantin Ritt 2014-02-15 09:35:34 +02:00 committed by The Qt Project
parent 70f4bf1a48
commit 8e57ad1a27

View File

@ -2916,7 +2916,8 @@ void QTextEngine::resolveAdditionalFormats() const
QTextFormatCollection *collection = formats();
specialData->resolvedFormats.resize(layoutData->items.count());
specialData->resolvedFormats.clear();
QVector<QTextCharFormat> resolvedFormats(layoutData->items.count());
QVarLengthArray<int, 64> addFormatSortedByStart;
addFormatSortedByStart.reserve(specialData->addFormats.count());
@ -2953,7 +2954,7 @@ void QTextEngine::resolveAdditionalFormats() const
++endIt;
}
QTextCharFormat &format = specialData->resolvedFormats[i];
QTextCharFormat &format = resolvedFormats[i];
if (block.docHandle()) {
// when we have a docHandle, formatIndex might still return a valid index based
// on the preeditPosition. for all other cases, we cleared the resolved format indices
@ -2968,6 +2969,8 @@ void QTextEngine::resolveAdditionalFormats() const
format = collection->charFormat(collection->indexForFormat(format)); // get shared copy
}
}
specialData->resolvedFormats = resolvedFormats;
}
QFixed QTextEngine::leadingSpaceWidth(const QScriptLine &line)