TextEditor: Fix painting text mark icons

Only take text marks with icons into account when looking for the three
textmarks with the highest priority to be drawn next to the line number.

Fixes: QTCREATORBUG-25427
Change-Id: I9c0b9cac2e34134e59071a4e2357585b3071c303
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2021-05-10 10:18:30 +02:00
parent c1abbf0802
commit c4605ebc07

View File

@@ -5143,11 +5143,11 @@ void TextEditorWidgetPrivate::paintTextMarks(QPainter &painter, const ExtraAreaP
TextMarks marks = userData->marks();
TextMarks::const_iterator it = marks.constBegin();
if (marks.size() > 3) {
// We want the 3 with the highest priority so iterate from the back
// We want the 3 with the highest priority that have an icon so iterate from the back
int count = 0;
it = marks.constEnd() - 1;
while (it != marks.constBegin()) {
if ((*it)->isVisible())
if ((*it)->isVisible() && !(*it)->icon().isNull())
++count;
if (count == 3)
break;
@@ -5157,7 +5157,7 @@ void TextEditorWidgetPrivate::paintTextMarks(QPainter &painter, const ExtraAreaP
TextMarks::const_iterator end = marks.constEnd();
for ( ; it != end; ++it) {
TextMark *mark = *it;
if (!mark->isVisible())
if (!mark->isVisible() && !mark->icon().isNull())
continue;
const int height = data.lineSpacing - 1;
const int width = int(.5 + height * mark->widthFactor());