Example of TextEdit using a QSyntaxHighlighter
-
Hi,
I notice that TextEdit provide a textDocument that can be used (if i understand well the documentation) to be used to set a QSyntaxHighlighter to provide syntax highlight to TextEdit.
But i fail to implement it. Someone have examples or source of apps using it ?
Thanks a lot
-
We have made a QSyntaxHighlighter C++ subclass for Python highlighting. It's based on something we found for PyQt. And, yes, we also missed some example code or apps who use this, so I hope the example can be helpful:
http://talktomachines.blogspot.com/2014/01/python-syntax-highlighting-for-qtextedit.html
Oliver
-
Hi,
Thanks for your example, that 's not really what i was looking for. I was looking for an example for using QSyntaxHighlighter in a QML TextEdit.
Anyway, during this time, i finnaly found how to implement that based on the qml texteditor example. You can see a really really basic syntax highlighter i made for ownNotes (a markdown note taking Sailfish QML apps) at https://github.com/khertan/ownNotes/tree/master/Sailfish/ownNotes/src
Regards
-
Sorry, indeed I realize, you are talking QML TextEdit. I'll check your example, thanks!
Oliver