Question about the tutorial on Code Editor from QtProject
-
Hi folks,
I read this tutorial on how to make a code editor based on a QPlainTextEdit : https://qt-project.org/doc/qt-4.8/widgets-codeeditor.html
But I didn't get the roleplay of a variable :
@void CodeEditor::updateLineNumberArea(const QRect &rect, int dy)
{
if (dy)
lineNumberArea->scroll(0, dy);
else
lineNumberArea->update(0, rect.y(), lineNumberArea->width(), rect.height());if (rect.contains(viewport()->rect())) updateLineNumberAreaWidth(0);
}@
What's the role of the "dy" variable ?
I dont get it.Thanks in advance. ;)
-
Hi,
dy carries the amount of pixels the viewport was scrolled, see "QPlainTextEdit::updateRequest":https://qt-project.org/doc/qt-4.8/qplaintextedit.html#updateRequest