MCPcopy Create free account
hub / github.com/KDE/kdevelop / renderMessageAndAge

Method renderMessageAndAge

kdevplatform/vcs/widgets/vcsannotationitemdelegate.cpp:167–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165}
166
167void VcsAnnotationItemDelegate::renderMessageAndAge(QPainter* painter,
168 const KTextEditor::StyleOptionAnnotationItem& option,
169 const QRect& messageRect, const QString& messageText,
170 const QRect& ageRect, const QString& ageText) const
171{
172 Q_UNUSED(option);
173
174 painter->save();
175
176 const auto normalStyle = option.view->defaultStyleAttribute(KSyntaxHighlighting::Theme::TextStyle::Normal);
177 painter->setPen(normalStyle->foreground().color());
178 painter->drawText(messageRect, Qt::AlignLeading | Qt::AlignVCenter,
179 painter->fontMetrics().elidedText(messageText, Qt::ElideRight, messageRect.width()));
180
181 // TODO: defaultStyleAttribute only returns reliably for TextStyle::Normal, so what to do for a comment-like color?
182 const auto commentStyle = option.view->defaultStyleAttribute(KSyntaxHighlighting::Theme::TextStyle::Normal);
183 painter->setPen(commentStyle->foreground().color());
184 painter->drawText(ageRect, Qt::AlignTrailing | Qt::AlignVCenter, ageText);
185
186 painter->restore();
187}
188
189void VcsAnnotationItemDelegate::renderAuthor(QPainter* painter,
190 const KTextEditor::StyleOptionAnnotationItem& option,

Callers

nothing calls this directly

Calls 1

saveMethod · 0.45

Tested by

no test coverage detected