

Below we add a set of toolbar buttons for editing, each defined as a QAction. Triggering any of these operations is simply a case of calling one the slot at the appropriate time. However, the QPlainTextEdit widget actually provides support for all of this through Qt slots.

Implementing all these operations on the text buffer directly would take some work.

To be useful an editor needs to be able to perform a lot of standard operations - copy, paste, cut, insert, clear. # If none, we haven't got a file open yet (or creating new). # self.path holds the path of the currently open file. # Setup the QTextEdit editor configurationįixedfont = QFontDatabase.systemFont(QFontDatabase.FixedFont) Self.editor = QPlainTextEdit() # Could also use a QTextEdit and set (False) Super(MainWindow, self)._init_(*args, **kwargs)
