Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to implement c-code editor
moyin last edited by
Actually i have design a "notepad" editor, but now i need this editor should aware of c-syntax and while going through Qt documentations i found syntax_highlighter example, but it is for c++ and that itself an codeEditor. I want just a piece of code that differentiate and identify the c-syntax so that i can include in my project. could any one please help in this regard.
But since c being a subset of c++ in many regards
what is wrong with the highlighting ?
Cant you just add any missing keywords and it works overall?
Pablo J. Rogina last edited by
@moyin are you referring to this example? If so, you can see that it uses a Highlighter object, which is subclassing the QSyntaxHighlighter class. That's the component you may need, as it defines and applies the highlighting rules. I guess the example is well documented, as it guides you step by step on what's needed to provide, specially regarding the highlighting part: regular expressions, formatting, etc.