void QCoreApplication::postEvent ( QObject * receiver, QEvent * event ) [static]
Adds the event event, with the object receiver as the receiver of the event, to an event queue and returns immediately. // 发送事件后立即返回,不等待执行结果
bool QCoreApplication::sendEvent ( QObject * receiver, QEvent * event ) [static]
Sends event event directly to receiver receiver, using the notify() function. Returns the value that was returned from the event handler. // 发送事件后等待直到事件接收者的slot函数执行完。
The event is not deleted when the event has been sent. The normal approach is to create the event on the stack, for example:
QMouseEvent event(QEvent::MouseButtonPress, pos, 0, 0, 0);
QApplication::sendEvent(mainWindow, &event);