Understanding of Signal and Slot in Qt
The Signal in the Qt is equivalent to the message in Win32 programming, and Slot is equivalent to the function of receiving a message in Win32 programming. An object in the Qt is issued under certain conditions, and the association of Connect, a response function (SLOT) receives this signal and performs the corresponding processing.
Application of Signal and Slot in Qt
Take a button OK as an example, click on it will pop up a window with Hello, World. Principle: The mouse click the button range, responds to the MouseClick event, and the other object is sent in the event to receive and respond by the onclick slot. Steps:
1. Create a new form in Qt-Designer, add a button that contains the word OK in Form.
2. Press F3 to enter the Connection Signal state, and the cross icon from pressing to the FORM, indicating that this connection is global.
3. In the popled Connection window, select Clicked () Sigal, select Accept () ..
4. In Edit / Slot. . The new SLOT in the window is created, and the property is set to public.
5. Set up the OK button Slot to Sendorder to create a new Connection
6. Save and generate the corresponding UI file and generate the corresponding program file with the UIC.
7. Cut the link program file in the cross-dictation environment, generate the corresponding executable.
8. Run the executable program to the SITSANG board.