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

Method paintSeparator

src/plugins/git/gui/gitdiffwidget.cpp:270–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268}
269
270void GitDiffEditor::paintSeparator(const QRect &eventRect) const
271{
272 QPainter painter(viewport());
273 const QPointF offset = contentOffset();
274 QTextBlock currentBlock = firstVisibleBlock();
275
276 while (currentBlock.isValid()) {
277 if (currentBlock.isVisible()) {
278 qreal top = blockBoundingGeometry(currentBlock).translated(offset).top();
279 qreal bottom = top + blockBoundingRect(currentBlock).height();
280
281 if (top > eventRect.bottom())
282 break;
283
284 if (bottom >= eventRect.top()) {
285 const int blockNumber = currentBlock.blockNumber();
286
287 auto it = diffData.blockSkippedLines.constFind(blockNumber);
288 if (it != diffData.blockSkippedLines.constEnd()) {
289 QString skippedRowsText = '[' + skippedText(it->first) + ']';
290 if (!it->second.isEmpty())
291 skippedRowsText += ' ' + it->second;
292 paintSeparator(painter, chunkLineForeground,
293 skippedRowsText, currentBlock, top);
294 }
295
296 const DiffFileInfo fileInfo = diffData.diffFileInfo.value(blockNumber);
297 if (!fileInfo.fileName.isEmpty()) {
298 const QString fileNameText = fileInfo.typeInfo.isEmpty()
299 ? fileInfo.fileName
300 : tr("[%1] %2").arg(fileInfo.typeInfo, fileInfo.fileName);
301 paintSeparator(painter, fileLineForeground,
302 fileNameText, currentBlock, top);
303 }
304 }
305 }
306 currentBlock = currentBlock.next();
307 }
308}
309
310void GitDiffEditor::paintSeparator(QPainter &painter, const QColor &color, const QString &text,
311 const QTextBlock &block, int top) const

Callers

nothing calls this directly

Calls 14

documentFunction · 0.85
isVisibleMethod · 0.80
topMethod · 0.80
bottomMethod · 0.80
widthMethod · 0.80
lineAtMethod · 0.80
restoreMethod · 0.80
isValidMethod · 0.45
isEmptyMethod · 0.45
valueMethod · 0.45
nextMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected