All the code to do this is in the codeeditor.h and codeeditor.cpp that make up the example. I cannot provide a simpler set of code.
The LineNumberArea class paints numbers onto itself when its paintEvent() is called by Qt. It uses the code in the function CodeEditor::lineNumberAreaPaintEvent() in its parent CodeEditor object to do this. The logic for setting the size, position and content of the line number area is in the CodeEditor.
We have no idea what role your class frameclass is supposed to have, but it currently makes no attempt to draw anything other than a blank background.
Bookmarks