| 115 | } |
| 116 | |
| 117 | void 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 | |
| 141 | void VcsAnnotationItemDelegate::renderBackground(QPainter* painter, |
| 142 | const KTextEditor::StyleOptionAnnotationItem& option, |