From f87fccafc181db7844a95367f0253a0da1e230f5 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 16 Dec 2022 10:54:21 +0100 Subject: [PATCH] TextEditor: prevent shaping text for indent depth painting QTextLines cursorToX indirectly calls shapeText which is not for free. We just want to have the x position for the line so there is no need to shape the complete text to get the position of the first cursor. Change-Id: I0ae636ed8250385b7ac77c6f37d45922bbf2e9bf Reviewed-by: Marcus Tillmanns --- src/plugins/texteditor/texteditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 285a13a588a..b9fda49c2ed 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -4475,7 +4475,7 @@ void TextEditorWidgetPrivate::paintIndentDepth(PaintEventData &data, const QTextLine textLine = blockData.layout->lineAt(0); const QRectF rect = textLine.naturalTextRect(); - qreal x = textLine.cursorToX(0) + data.offset.x() + qMax(0, q->cursorWidth() - 1) + qreal x = textLine.x() + data.offset.x() + qMax(0, q->cursorWidth() - 1) + horizontalAdvance * m_visualIndentOffset; int paintColumn = 0;