forked from qt-creator/qt-creator
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user