Hello people!
I want to know how a QTextEdit is enabled with syntax highlighting. Can anyone give me the procedure to check 'C' programming syntax in texteditor. I tried with
but finding difficulty in using this option. Please post a reply.
Printable View
Hello people!
I want to know how a QTextEdit is enabled with syntax highlighting. Can anyone give me the procedure to check 'C' programming syntax in texteditor. I tried with
but finding difficulty in using this option. Please post a reply.
You need to subclass QSyntaxHighlighter and override:
QSyntaxHighlighter::highlightParagraph()
This function is called when necessary (the given paragraph has changed).
Just pass the text edit object to QSyntaxHighlighter's constructor. It will then install the syntax highlighter on the text edit.
QSyntaxHighlighter::QSyntaxHighlighter(QTextEdit* textEdit):
Quote:
Constructs the QSyntaxHighlighter and installs it on textEdit.
It is the caller's responsibility to delete the QSyntaxHighlighter when it is no longer needed.
Hello
Thank you for the reply.
I will try this at my end.