Editor: filter text marks in paintAnnotation

Calculate the correct width for the annotation and decide inside
TextMark whether it can be painted or not. This will also
make sure that all annotation rectangles are correctly saved in
TextEditorWidgetPrivate::updateLineAnnotation.

Change-Id: I7e6c606e615b1673a34000618e106efb14184b10
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2022-03-11 13:37:21 +01:00
parent a8cad01887
commit febe659690
3 changed files with 29 additions and 10 deletions

View File

@@ -4020,8 +4020,13 @@ void TextEditorWidgetPrivate::updateLineAnnotation(const PaintEventData &data,
boundingRect = QRectF(x, boundingRect.top(), q->viewport()->width() - x, boundingRect.height());
if (boundingRect.isEmpty())
break;
if (data.eventRect.intersects(boundingRect.toRect()))
mark->paintAnnotation(painter, &boundingRect, offset, itemOffset / 2, q->contentOffset());
mark->paintAnnotation(painter,
data.eventRect,
&boundingRect,
offset,
itemOffset / 2,
q->contentOffset());
x = boundingRect.right();
offset = itemOffset / 2;