I have a simple PyQt text editor, and would like to apply QScintilla formatting to it. I need to use a QTextEdit for the text, as it provides other functionality that I am using (cursor position, raw text output, etc), and would like to apply QScintilla formatting.
Just for refrence, the initialisation of the QTextEdit:
self.text = QtGui.QTextEdit(self)
I believe you cannot use QScintilla
directly with QTextEdit
.
But have a look at this question: stackoverflow.com/questions/20951660/… and if you want to see the usage QTextEdit
(or QPlainTextEdit
) with QSyntaxHiglighter
, see for example this: http://wiki.python.org/moin/PyQt/Python%20syntax%20highlighting or this http://carsonfarmer.com/2009/07/syntax-highlighting-with-pyqt/ which uses very basic syntax highlighter for Python code.