MCPcopy Create free account
hub / github.com/Kitware/ParaView / paintEvent

Method paintEvent

Qt/Python/pqPythonLineNumberArea.cxx:39–68  ·  view source on GitHub ↗

-----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

37
38//-----------------------------------------------------------------------------
39void pqPythonLineNumberArea::paintEvent(QPaintEvent* event)
40{
41 QPainter painter(this);
42
43 const QPalette& palette = this->palette();
44
45 painter.fillRect(event->rect(), palette.window());
46 painter.setFont(this->TextEdit.font());
47
48 const QSize size = this->sizeHint();
49
50 std::int32_t firstBlockId = std::max(0, details::getFirstVisibleBlockId(this->TextEdit) - 1);
51 QTextBlock block = this->TextEdit.document()->findBlockByNumber(firstBlockId);
52
53 while (block.isValid() && block.isVisible())
54 {
55 const QTextCursor blockCursor(block);
56 const QRect blockCursorRect = this->TextEdit.cursorRect(blockCursor);
57
58 painter.setPen((this->TextEdit.textCursor().blockNumber() == firstBlockId)
59 ? palette.text().color()
60 : palette.placeholderText().color());
61 const QString number = QString::number(firstBlockId + 1);
62 painter.drawText(-5, blockCursorRect.y() + 2, size.width(),
63 this->TextEdit.fontMetrics().height(), Qt::AlignRight, number);
64
65 block = block.next();
66 firstBlockId++;
67 }
68}

Callers

nothing calls this directly

Calls 10

sizeHintMethod · 0.95
maxFunction · 0.85
getFirstVisibleBlockIdFunction · 0.85
isValidMethod · 0.80
placeholderTextMethod · 0.80
heightMethod · 0.80
nextMethod · 0.80
isVisibleMethod · 0.45
colorMethod · 0.45
textMethod · 0.45

Tested by

no test coverage detected