The implementation of the interactive function of the 41st course editing

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.