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

Method setFirstLine

src/difftextwindow.cpp:504–528  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

502}
503
504void DiffTextWindow::setFirstLine(LineRef firstLine)
505{
506 qint32 fontHeight = fontMetrics().lineSpacing();
507
508 LineRef newFirstLine = std::max<LineRef>(0, firstLine);
509
510 qint32 deltaY = fontHeight * (d->m_firstLine - newFirstLine);
511
512 d->m_firstLine = newFirstLine;
513
514 if(d->m_bSelectionInProgress && d->m_selection.isValidFirstLine())
515 {
516 LineRef line;
517 qint32 pos;
518 convertToLinePos(d->m_lastKnownMousePos.x(), d->m_lastKnownMousePos.y(), line, pos);
519 d->m_selection.end(line, pos);
520 update();
521 }
522 else
523 {
524 scroll(0, deltaY);
525 }
526
527 Q_EMIT firstLineChanged(d->m_firstLine);
528}
529
530LineRef DiffTextWindow::getFirstLine() const
531{

Callers

nothing calls this directly

Calls 7

isValidFirstLineMethod · 0.80
endMethod · 0.80
getLineNumberWidthMethod · 0.80
calcTopLineInFileMethod · 0.80
setTextMethod · 0.80
getDiff3LineVectorMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected