1. General editing interaction features
(1) Copy (copy), paste (Paste), cut (cut), undo (undo), Redo (Redo), remove (delete)
(2) Qplaintextedit provides a rich interface for interactive functions
2. Signal-to-slot connection
Implementation of the basic editing function of "programming experiment"
3. interface State in the text editor
(1) It is not always possible to copy, paste, undo or redo. (That is, some of the buttons have to be grayed out)
(2) Qplaintextedit can send signals related to the state of the interface
①void copyavailable (bool yes);
②void redoavailable (bool available);
③void undoavailable (bool available);
④void cursorpositionchanged ();//cursor position changed (note not mouse)
(3) Implementation steps
① connecting the interface state signal to a custom slot function
② find the corresponding Qaction object by text information
③ setting the interface state of Qaction objects based on signal flags
Edit Experiment Interface Status update
4. Summary
(1) Qplaintextedit encapsulates common text editing functions
(2) The signal can be connected directly to the public slot function of the Qplaintextedit
(3) interface state is the key and difficult Point of GUI development
(4) The status signal of components in QT can simplify the maintenance of the interface state.
(5) The components in the main window can be retrieved by traversal .
The implementation of the interactive function of the 41st course editing