Qt-- send custom events, multi-page switching components

A. Sending a custom event

A.Qt can autonomously transmit event in the program
1. obstructive events sent - after transmitting an event wait event completes
2 non-blocking event transmission - return immediately after sending an event, the event is sent to the event queue for processing
QApplication class provides support for events sent static member function
obstructive send sendEvent function BOOL (QObject Receiver, QEvent event)
non-blocking send function postEvent void (QObject Receiver, QEvent event)
Notes
lifetime 1.sendEvent the event object Qt by the program Manager - support event object stack and heap the event object while sending
2.postEvent in lifetime event object managed by the Qt platform - can only send the event object heap, the event is destroyed by the post-processing platform Qt
send events using sendEvent objects
Qt-- send custom events, multi-page switching components
using postEvent send event objects
Qt-- send custom events, multi-page switching components

Guess you like

Origin blog.51cto.com/13475106/2430093