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

Method doAuthorLineLayout

kdevplatform/vcs/widgets/vcsannotationitemdelegate.cpp:117–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117void VcsAnnotationItemDelegate::doAuthorLineLayout(const KTextEditor::StyleOptionAnnotationItem& option,
118 QRect* authorRect) const
119{
120 Q_ASSERT(authorRect);
121
122 // if invalid, nothing to be done, keep as is
123 if (!authorRect->isValid()) {
124 return;
125 }
126
127 const QWidget* const widget = option.view;
128 QStyle* const style = widget ? widget->style() : QApplication::style();
129 // "+ 1" as used in QItemDelegate
130 const int authorMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, nullptr, widget) + 1;
131
132 QRect author = option.rect;
133 // remove margins here, so renderAuthor does not have to
134 author.adjust(authorMargin, 0, -authorMargin, 0);
135
136 // return result
137 *authorRect = QStyle::alignedRect(option.direction, Qt::AlignLeading,
138 authorRect->size().boundedTo(author.size()), author);
139}
140
141void VcsAnnotationItemDelegate::renderBackground(QPainter* painter,
142 const KTextEditor::StyleOptionAnnotationItem& option,

Callers

nothing calls this directly

Calls 3

styleMethod · 0.80
isValidMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected