From 318b83587ffd3a4ca15c527228ca47c412dd593a Mon Sep 17 00:00:00 2001 From: David Schulz Date: Tue, 4 Dec 2018 09:56:59 +0100 Subject: TextEditor: fix painting annotations The painting of annotations for one line will be aborted as soon as we hit the first text mark that returns an empty bounding rect for the annotation. This results in no painting at all when having a line with multiple text marks with and without annotation. Prefilter the text marks to make sure we only try to paint text marks with an annotation. Change-Id: I4f07127fafe935b2ad4ed418b326b6f2ab5b1c50 Fixes: QTCREATORBUG-21628 Reviewed-by: Christian Stenger --- src/plugins/texteditor/texteditor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/plugins/texteditor/texteditor.cpp') diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 47beba5706..8b03581a40 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -4106,12 +4106,12 @@ void TextEditorWidgetPrivate::updateLineAnnotation(const PaintEventData &data, if (!blockUserData) return; - TextMarks marks = blockUserData->marks(); - - const bool annotationsVisible = Utils::anyOf(marks, [](const TextMark* mark) { + TextMarks marks = Utils::filtered(blockUserData->marks(), [](const TextMark* mark){ return !mark->lineAnnotation().isEmpty(); }); + const bool annotationsVisible = !marks.isEmpty(); + if (updateAnnotationBounds(blockUserData, data.documentLayout, annotationsVisible) || !annotationsVisible) { return; -- cgit v1.2.1