Editor: ensure block is layouted when painting it

The painting of an editor assumes the block is layouted properly. This
was done implicitly when calculating the block bounding rect previously.
With the option to replace the block layout with another document this
is not the case anymore, so we need to explicitly make sure that a block
was layouted before painting.

Change-Id: If6947a3a5c13a03310e0cab0f6fcbd4ff8078b1b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
David Schulz
2023-03-02 09:20:51 +01:00
parent 007c47a2d4
commit 18364db94a

View File

@@ -4849,6 +4849,7 @@ void TextEditorWidget::paintEvent(QPaintEvent *e)
if (blockData.boundingRect.bottom() >= data.eventRect.top()
&& blockData.boundingRect.top() <= data.eventRect.bottom()) {
data.documentLayout->ensureBlockLayout(data.block);
d->setupBlockLayout(data, painter, blockData);
blockData.position = data.block.position();
blockData.length = data.block.length();