3

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)
Bob Eret
  • 59
  • 3
  • 12
  • 1
    You can't - they just do not work in the same way at all. For `QTextEdit`, use [QSyntaxHighlighter](https://doc.qt.io/qt-4.8/qsyntaxhighlighter.html). – ekhumoro Sep 28 '16 at 19:10
  • Please check out this new website with a beginners tutorial on QScintilla: http://qscintilla.com – K.Mulier Jan 26 '17 at 13:35

1 Answers1

1

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.