Merges several overloaded functions in QCoreApplication.

The source compatibility is kept.

Change-Id: If66053b271d65062b3c0ce6ec66c8394a37b4e3e
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Xizhi Zhu 2012-02-19 10:15:18 +01:00 committed by Qt by Nokia
parent 2597d61175
commit 2b50e20578
2 changed files with 6 additions and 63 deletions

View File

@ -1011,35 +1011,6 @@ void QCoreApplication::exit(int returnCode)
*/
/*!
Adds the event \a event, with the object \a receiver as the
receiver of the event, to an event queue and returns immediately.
The event must be allocated on the heap since the post event queue
will take ownership of the event and delete it once it has been
posted. It is \e {not safe} to access the event after
it has been posted.
When control returns to the main event loop, all events that are
stored in the queue will be sent using the notify() function.
Events are processed in the order posted. For more control over
the processing order, use the postEvent() overload below, which
takes a priority argument. This function posts all event with a
Qt::NormalEventPriority.
\threadsafe
\sa sendEvent(), notify(), sendPostedEvents()
*/
void QCoreApplication::postEvent(QObject *receiver, QEvent *event)
{
postEvent(receiver, event, Qt::NormalEventPriority);
}
/*!
\overload postEvent()
\since 4.3
Adds the event \a event, with the object \a receiver as the
@ -1166,13 +1137,6 @@ bool QCoreApplication::compressEvent(QEvent *event, QObject *receiver, QPostEven
return false;
}
/*!
\fn void QCoreApplication::sendPostedEvents()
\overload sendPostedEvents()
Dispatches all posted events, i.e. empties the event queue.
*/
/*!
Immediately dispatches all events which have been previously queued
with QCoreApplication::postEvent() and which are for the object \a receiver
@ -1188,7 +1152,6 @@ bool QCoreApplication::compressEvent(QEvent *event, QObject *receiver, QPostEven
\sa flush(), postEvent()
*/
void QCoreApplication::sendPostedEvents(QObject *receiver, int event_type)
{
QThreadData *data = QThreadData::current();
@ -1343,23 +1306,6 @@ void QCoreApplicationPrivate::sendPostedEvents(QObject *receiver, int event_type
}
/*!
Removes all events posted using postEvent() for \a receiver.
The events are \e not dispatched, instead they are removed from the
queue. You should never need to call this function. If you do call it,
be aware that killing events may cause \a receiver to break one or
more invariants.
\threadsafe
*/
void QCoreApplication::removePostedEvents(QObject *receiver)
{
removePostedEvents(receiver, 0);
}
/*!
\overload removePostedEvents()
\since 4.3
Removes all events of the given \a eventType that were posted
@ -1372,7 +1318,9 @@ void QCoreApplication::removePostedEvents(QObject *receiver)
If \a receiver is null, the events of \a eventType are removed for
all objects. If \a eventType is 0, all the events are removed for
\a receiver.
\a receiver. You should never call this function with \a eventType
of 0. If you do call it in this way, be aware that killing events
may cause \a receiver to break one or more invariants.
\threadsafe
*/

View File

@ -110,12 +110,9 @@ public:
static void exit(int retcode=0);
static bool sendEvent(QObject *receiver, QEvent *event);
static void postEvent(QObject *receiver, QEvent *event);
static void postEvent(QObject *receiver, QEvent *event, int priority);
static void sendPostedEvents(QObject *receiver, int event_type);
static void sendPostedEvents();
static void removePostedEvents(QObject *receiver);
static void removePostedEvents(QObject *receiver, int eventType);
static void postEvent(QObject *receiver, QEvent *event, int priority = Qt::NormalEventPriority);
static void sendPostedEvents(QObject *receiver = 0, int event_type = 0);
static void removePostedEvents(QObject *receiver, int eventType = 0);
static bool hasPendingEvents();
static QAbstractEventDispatcher *eventDispatcher();
static void setEventDispatcher(QAbstractEventDispatcher *eventDispatcher);
@ -211,8 +208,6 @@ inline bool QCoreApplication::sendEvent(QObject *receiver, QEvent *event)
inline bool QCoreApplication::sendSpontaneousEvent(QObject *receiver, QEvent *event)
{ if (event) event->spont = true; return self ? self->notifyInternal(receiver, event) : false; }
inline void QCoreApplication::sendPostedEvents() { sendPostedEvents(0, 0); }
#ifdef QT_NO_TRANSLATION
// Simple versions
inline QString QCoreApplication::translate(const char *, const char *sourceText,