From 18364db94a336087d1160980ce9efdb51bc4edbb Mon Sep 17 00:00:00 2001 From: David Schulz Date: Thu, 2 Mar 2023 09:20:51 +0100 Subject: [PATCH] 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: Reviewed-by: Marcus Tillmanns --- src/plugins/texteditor/texteditor.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index db2f0de9c9e..cc37fca79d5 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -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();