Coco: use the diagnostic foreground color as annotation color

Change-Id: I4f0991c8956b0b31a441aa4348aaf8b7d0677dda
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2022-05-09 14:58:37 +02:00
parent 38ec866d57
commit c5f424d696
3 changed files with 28 additions and 6 deletions

View File

@@ -155,13 +155,12 @@ void TextMark::paintAnnotation(QPainter &painter,
return;
}
const QColor &markColor = m_color.has_value()
? Utils::creatorTheme()->color(m_color.value()).toHsl()
: painter.pen().color();
const QColor &markColor = annotationColor();
const FontSettings &fontSettings = m_baseTextDocument->fontSettings();
const AnnotationColors &colors = AnnotationColors::getAnnotationColors(
markColor, fontSettings.toTextCharFormat(C_TEXT).background().color());
markColor.isValid() ? markColor : painter.pen().color(),
fontSettings.toTextCharFormat(C_TEXT).background().color());
painter.save();
QLinearGradient grad(rects.fadeInRect.topLeft() - contentOffset,
@@ -355,6 +354,13 @@ bool TextMark::addToolTipContent(QLayout *target) const
return true;
}
QColor TextMark::annotationColor() const
{
if (m_color.has_value())
return Utils::creatorTheme()->color(*m_color).toHsl();
return {};
}
void TextMark::setIcon(const QIcon &icon)
{
m_icon = icon;