MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / paintLineNumbers

Method paintLineNumbers

src/plugins/git/gui/giteditor.cpp:179–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177};
178
179void GitEditorPrivate::paintLineNumbers(QPainter &painter,
180 const ExtraAreaPaintEventData &data,
181 const QRectF &blockBoundingRect) const
182{
183 const QString &number = q->lineNumber(data.block.blockNumber());
184 const bool selected = ((data.selectionStart < data.block.position() + data.block.length()
185 && data.selectionEnd > data.block.position())
186 || (data.selectionStart == data.selectionEnd && data.selectionEnd == data.block.position()));
187 if (selected) {
188 painter.save();
189 QFont f = painter.font();
190 f.setBold(data.currentLineNumberFormat.font().bold());
191 f.setItalic(data.currentLineNumberFormat.font().italic());
192 painter.setFont(f);
193 painter.setPen(data.currentLineNumberFormat.foreground().color());
194 if (data.currentLineNumberFormat.background() != Qt::NoBrush) {
195 painter.fillRect(QRectF(0, blockBoundingRect.top(),
196 data.extraAreaWidth, blockBoundingRect.height()),
197 data.currentLineNumberFormat.background().color());
198 }
199 }
200 painter.drawText(QRectF(0, blockBoundingRect.top(),
201 data.extraAreaWidth - 4, blockBoundingRect.height()),
202 Qt::AlignRight,
203 number);
204 if (selected)
205 painter.restore();
206}
207
208GitEditor::GitEditor(QWidget *parent)
209 : QPlainTextEdit(parent),

Callers 1

extraAreaPaintEventMethod · 0.80

Calls 9

fontMethod · 0.80
topMethod · 0.80
restoreMethod · 0.80
lineNumberMethod · 0.45
lengthMethod · 0.45
saveMethod · 0.45
setFontMethod · 0.45
colorMethod · 0.45
drawTextMethod · 0.45

Tested by

no test coverage detected