PDA

View Full Version : How is recomended way to implement syntax highlighting, parenteses matching and spell



Szyk
14th July 2017, 13:40
Hello
How is the recommended way to implement syntax highlighting, parentheses matching and spell checking in Qt based text editor?
I found (and wrote) that it can be done by single huge and complicated QSyntaxHighlighter descendant. But it is hard to read and difficult to modify. And certain it is not modular way.
I try to replace my syntax highlighter with more fancy KSyntaxHighlighter, but I can't figure out how to add spell checking without modify KSyntaxHighlighter itself.
I add my old syntax highlighter (with syntax highlighting disabled and with only spell checking enabled) and spell checking works but KSyntaxHighlighter not.
So they don't work in the parallel. However they should - I check that they only connect to one of QTextDocument signals.
I was thought about subclassing KSyntaxHighlighter in order to add my spell checking, but I feel it is not right way.

So: How to use KSyntaxHighlighter with my own spell checking?

thanks and best regards
Szyk Cech