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

Method paintEvent

src/mergeresultwindow.cpp:1583–1674  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1581}
1582
1583void MergeResultWindow::paintEvent(QPaintEvent*)
1584{
1585 if(m_pDiff3LineList == nullptr)
1586 return;
1587
1588 const QFontMetrics& fm = fontMetrics();
1589 const qint32 fontWidth = fm.horizontalAdvance('0');
1590
1591 if(!m_bCursorUpdate) // Don't redraw everything for blinking cursor?
1592 {
1593 const auto dpr = devicePixelRatioF();
1594 if(size() * dpr != m_pixmap.size())
1595 {
1596 m_pixmap = QPixmap(size() * dpr);
1597 m_pixmap.setDevicePixelRatio(dpr);
1598 }
1599
1600 RLPainter p(&m_pixmap, gOptions->m_bRightToLeftLanguage, width(), fontWidth);
1601 p.setFont(font());
1602 p.QPainter::fillRect(rect(), gOptions->backgroundColor());
1603
1604 //qint32 visibleLines = height() / fontHeight;
1605
1606 const LineRef lastVisibleLine = m_firstLine + getNofVisibleLines() + 5;
1607 LineRef line = 0;
1608 MergeBlockList::const_iterator mbIt = m_mergeBlockList.cbegin();
1609 for(; mbIt != m_mergeBlockList.cend(); ++mbIt)
1610 {
1611 const MergeBlock& mb = *mbIt;
1612 if(line > lastVisibleLine || line + mb.lineCount() < m_firstLine)
1613 {
1614 line += mb.lineCount();
1615 }
1616 else
1617 {
1618 MergeEditLineList::const_iterator melIt;
1619 for(melIt = mb.list().cbegin(); melIt != mb.list().cend(); ++melIt)
1620 {
1621 if(line >= m_firstLine && line <= lastVisibleLine)
1622 {
1623 const MergeEditLine& mel = *melIt;
1624 MergeEditLineList::const_iterator melIt1 = melIt;
1625 ++melIt1;
1626
1627 RangeFlags rangeMark = RangeMark::none;
1628 if(melIt == mb.list().cbegin()) rangeMark |= RangeMark::begin; // Begin range mark
1629 if(melIt1 == mb.list().cend()) rangeMark |= RangeMark::end; // End range mark
1630
1631 if(mbIt == m_currentMergeBlockIt) rangeMark |= RangeMark::current; // Mark of the current line
1632
1633 const QString s = mel.getString(m_pldA, m_pldB, m_pldC);
1634
1635 writeLine(p, line, s, mel.src(), mb.details(), rangeMark,
1636 mel.isModified(), mel.isRemoved(), mb.isWhiteSpaceConflict());
1637 }
1638 ++line;
1639 }
1640 }

Callers

nothing calls this directly

Calls 13

QPixmapClass · 0.85
getStringFunction · 0.85
setFontMethod · 0.80
srcMethod · 0.80
detailsMethod · 0.80
isModifiedMethod · 0.80
isRemovedMethod · 0.80
isWhiteSpaceConflictMethod · 0.80
endMethod · 0.80
setPenMethod · 0.80
sizeMethod · 0.45
lineCountMethod · 0.45

Tested by

no test coverage detected