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 <marcus.tillmanns@qt.io>
This commit is contained in:
David Schulz
2022-12-16 10:54:21 +01:00
parent c8e1201236
commit f87fccafc1

View File

@@ -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;