Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

bool QCoreApplication::notify ( QObject receiver,
QEvent event 
) [virtual]

Sends event to receiver: {receiver}->event(event). Returns the value that is returned from the receiver's event handler.

For certain types of events (e.g. mouse and key events), the event will be propagated to the receiver's parent and so on up to the top-level object if the receiver is not interested in the event (i.e., it returns false).

There are five different ways that events can be processed; reimplementing this virtual function is just one of them. All five approaches are listed below: 1 Reimplementing paintEvent(), mousePressEvent() and so on. This is the commonest, easiest and least powerful way.

Reimplementing this function. This is very powerful, providing complete control; but only one subclass can be active at a time.

Installing an event filter on QCoreApplication::instance(). Such an event filter is able to process all events for all widgets, so it's just as powerful as reimplementing notify(); furthermore, it's possible to have more than one application-global event filter. Global event filters even see mouse events for {QWidget::isEnabled()}{disabled widgets}.

Reimplementing QObject::event() (as QWidget does). If you do this you get Tab key presses, and you get to see the events before any widget-specific event filters.

Installing an event filter on the object. Such an event filter gets all the events except Tab and Shift-Tab key presses.

See also:
QObject::event(), installEventFilter()

Reimplemented in QApplication.

Definition at line 578 of file qcoreapplication.cpp.

References QObject::isWidgetType(), and QEvent::type().

Referenced by notifyInternal().

    // no events are delivered after ~QCoreApplication() has started
    if (QCoreApplicationPrivate::is_app_closing)
        return true;

    if (receiver == 0) {                        // serious error
        qWarning("QCoreApplication::notify: Unexpected null receiver");
        return true;

#ifndef QT_NO_DEBUG

#ifdef QT3_SUPPORT
    if (event->type() == QEvent::ChildRemoved && !receiver->d_func()->pendingChildInsertedEvents.isEmpty())
        receiver->d_func()->removePendingChildInsertedEvents(static_cast<QChildEvent *>(event)->child());
#endif // QT3_SUPPORT

    return receiver->isWidgetType() ? false : d->notify_helper(receiver, event);

Generated by  Doxygen 1.6.0   Back to index