Editor: Use optional for text mark color

instead of an additional hasColor member

Change-Id: I658401bb91374b10420e070625cf61049cb3cc64
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
David Schulz
2020-01-03 14:43:35 +01:00
parent ff61ed69d3
commit 67db5cb2de
3 changed files with 13 additions and 12 deletions

View File

@@ -136,8 +136,9 @@ void TextMark::paintAnnotation(QPainter &painter, QRectF *annotationRect,
const AnnotationRects &rects = annotationRects(*annotationRect, painter.fontMetrics(),
fadeInOffset, fadeOutOffset);
const QColor &markColor = m_hasColor ? Utils::creatorTheme()->color(m_color).toHsl()
: painter.pen().color();
const QColor &markColor = m_color.has_value()
? Utils::creatorTheme()->color(m_color.value()).toHsl()
: painter.pen().color();
const AnnotationColors &colors = AnnotationColors::getAnnotationColors(
markColor, painter.background().color());
@@ -327,15 +328,13 @@ bool TextMark::addToolTipContent(QLayout *target) const
return true;
}
Theme::Color TextMark::color() const
Utils::optional<Theme::Color> TextMark::color() const
{
QTC_CHECK(m_hasColor);
return m_color;
}
void TextMark::setColor(const Theme::Color &color)
{
m_hasColor = true;
m_color = color;
}