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

Method printWindow

src/difftextwindow.cpp:479–502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

477}
478
479void DiffTextWindow::printWindow(RLPainter& painter, const QRect& view, const QString& headerText, qint32 line, const LineType linesPerPage, const QColor& fgColor)
480{
481 QRect clipRect = view;
482 clipRect.setTop(0);
483 painter.setClipRect(clipRect);
484 painter.translate(view.left(), 0);
485 QFontMetrics fm = painter.fontMetrics();
486 {
487 qint32 lineHeight = fm.height() + fm.ascent();
488 const QRectF headerRect(0, 5, view.width(), 3 * (lineHeight));
489 QTextOption options;
490 options.setWrapMode(QTextOption::WordWrap);
491 // TODO: transition to Qt::LayoutDirectionAuto
492 options.setTextDirection(Qt::LeftToRight);
493 static_cast<QPainter&>(painter).drawText(headerRect, headerText, options);
494
495 painter.setPen(fgColor);
496 painter.drawLine(0, view.top() - 2, view.width(), view.top() - 2);
497 }
498
499 painter.translate(0, view.top());
500 print(painter, view, line, linesPerPage);
501 painter.resetTransform();
502}
503
504void DiffTextWindow::setFirstLine(LineRef firstLine)
505{

Callers 1

slotFilePrintMethod · 0.80

Calls 4

widthMethod · 0.80
drawTextMethod · 0.80
setPenMethod · 0.80
drawLineMethod · 0.80

Tested by

no test coverage detected