How do I apply QScintilla syntax highlighting to a QTextEdit in PyQt4?
<p>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. </p>

<p>Just for refrence, the initialisation of the QTextEdit:</p>

<pre><code>self.text = QtGui.QTextEdit(self)
</code></pre>

<p>I believe you cannot use <code>QScintilla</code> directly with <code>QTextEdit</code>. </p>

<p>But have a look at this question: stackoverflow.com/questions/20951660/â¦ and if you want to see the usage <code>QTextEdit</code> (or <code>QPlainTextEdit</code>) with <code>QSyntaxHiglighter</code>, see for example this: <a href="http://wiki.python.org/moin/PyQt/Python%20syntax%20highlighting" rel="nofollow">http://wiki.python.org/moin/PyQt/Python%20syntax%20highlighting</a> or this <a href="http://carsonfarmer.com/2009/07/syntax-highlighting-with-pyqt/" rel="nofollow">http://carsonfarmer.com/2009/07/syntax-highlighting-with-pyqt/</a> which uses very basic syntax highlighter for Python code.</p>

python qt pyqt scintilla qscintilla