Adding new functionality to CodeEditor example
-
I've seen example of creating line numbers using QPlainTextEdit from here. But now i also want to draw lines between strings. My idea was to override
CodeEditor::paintEvent(). So the question is: can i call -QPlainTextEdit::paintEvent()fromCodeEditor::paintEvent()to saveQPlainTextEdit::paintEvent()functionality and then draw lines in it?
If not, what is the best way to achieve this? -
I've seen example of creating line numbers using QPlainTextEdit from here. But now i also want to draw lines between strings. My idea was to override
CodeEditor::paintEvent(). So the question is: can i call -QPlainTextEdit::paintEvent()fromCodeEditor::paintEvent()to saveQPlainTextEdit::paintEvent()functionality and then draw lines in it?
If not, what is the best way to achieve this? -
@Khamza
Yes, assuming you meanCodeEditorinheritsQPlainTextEdit. From your overriddenpaintEvent()call the base one and then you could add your own extra drawing, if that is what you want to do. -
@JonB Yeah, it is. But i read that i should not call
paintEvent()directly. Isn't this the case? -
K Khamza has marked this topic as solved on