forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/9.0'
Change-Id: I2123e09f75199a63af6e8505fb8889e7f9d025d2
This commit is contained in:
@@ -686,6 +686,8 @@ public:
|
||||
{
|
||||
QRectF rect;
|
||||
const TextMark *mark;
|
||||
friend bool operator==(const AnnotationRect &a, const AnnotationRect &b)
|
||||
{ return a.mark == b.mark && a.rect == b.rect; }
|
||||
};
|
||||
QMap<int, QList<AnnotationRect>> m_annotationRects;
|
||||
QRectF getLastLineLineRect(const QTextBlock &block);
|
||||
@@ -4026,7 +4028,7 @@ void TextEditorWidgetPrivate::updateLineAnnotation(const PaintEventData &data,
|
||||
const PaintEventBlockData &blockData,
|
||||
QPainter &painter)
|
||||
{
|
||||
m_annotationRects.remove(data.block.blockNumber());
|
||||
const QList<AnnotationRect> previousRects = m_annotationRects.take(data.block.blockNumber());
|
||||
|
||||
if (!m_displaySettings.m_displayAnnotations)
|
||||
return;
|
||||
@@ -4084,6 +4086,7 @@ void TextEditorWidgetPrivate::updateLineAnnotation(const PaintEventData &data,
|
||||
}
|
||||
}
|
||||
|
||||
QList<AnnotationRect> newRects;
|
||||
for (const TextMark *mark : std::as_const(marks)) {
|
||||
boundingRect = QRectF(x, boundingRect.top(), q->viewport()->width() - x, boundingRect.height());
|
||||
if (boundingRect.isEmpty())
|
||||
@@ -4098,8 +4101,16 @@ void TextEditorWidgetPrivate::updateLineAnnotation(const PaintEventData &data,
|
||||
|
||||
x = boundingRect.right();
|
||||
offset = itemOffset / 2;
|
||||
m_annotationRects[data.block.blockNumber()].append({boundingRect, mark});
|
||||
newRects.append({boundingRect, mark});
|
||||
}
|
||||
|
||||
if (previousRects != newRects) {
|
||||
for (const AnnotationRect &annotationRect : qAsConst(newRects))
|
||||
q->viewport()->update(annotationRect.rect.toAlignedRect());
|
||||
for (const AnnotationRect &annotationRect : previousRects)
|
||||
q->viewport()->update(annotationRect.rect.toAlignedRect());
|
||||
}
|
||||
m_annotationRects[data.block.blockNumber()] = newRects;
|
||||
}
|
||||
|
||||
QColor blendRightMarginColor(const FontSettings &settings, bool areaColor)
|
||||
|
||||
Reference in New Issue
Block a user