MCPcopy Create free account
hub / github.com/KDE/kdiff3 / paintEvent

Method paintEvent

src/difftextwindow.cpp:1286–1310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1284}
1285
1286void DiffTextWindow::paintEvent(QPaintEvent* e)
1287{
1288 QRect invalidRect = e->rect();
1289 if(invalidRect.isEmpty())
1290 return;
1291
1292 if(d->getDiff3LineVector() == nullptr || (d->m_diff3WrapLineVector.empty() && d->m_bWordWrap))
1293 {
1294 QPainter p(this);
1295 p.fillRect(invalidRect, gOptions->backgroundColor());
1296 return;
1297 }
1298
1299 LineRef endLine = std::min(d->m_firstLine + getNofVisibleLines() + 2, getNofLines());
1300 RLPainter p(this, gOptions->m_bRightToLeftLanguage, width(), fontMetrics().horizontalAdvance('0'));
1301
1302 p.setFont(font());
1303 p.QPainter::fillRect(invalidRect, gOptions->backgroundColor());
1304
1305 draw(p, invalidRect, d->m_firstLine, endLine);
1306 p.end();
1307
1308 d->m_oldFirstLine = d->m_firstLine;
1309 d->m_selection.clearOldSelection();
1310}
1311
1312void DiffTextWindow::print(RLPainter& p, const QRect&, qint32 firstLine, const LineType nofLinesPerPage)
1313{

Callers

nothing calls this directly

Calls 6

fillRectMethod · 0.80
setFontMethod · 0.80
endMethod · 0.80
clearOldSelectionMethod · 0.80
isEmptyMethod · 0.45
getDiff3LineVectorMethod · 0.45

Tested by

no test coverage detected