summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorXizhi Zhu <xizhi.zhu@gmail.com>2012-02-19 10:15:18 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-20 19:51:41 +0100
commit2b50e205780f007dd5c2955cd7d492d3f5f909b1 (patch)
treeb71867a5544db880961a8c82ebd8dca375a00991 /src/corelib/kernel
parent2597d61175172b387956205ea6837af07b9e1f08 (diff)
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>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp58
-rw-r--r--src/corelib/kernel/qcoreapplication.h11
2 files changed, 6 insertions, 63 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 80e42336d6..2d49b271ce 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -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
@@ -1167,13 +1138,6 @@ bool QCoreApplication::compressEvent(QEvent *event, QObject *receiver, QPostEven
}
/*!
- \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
and have the event type \a event_type.
@@ -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
*/
diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h
index d1fba3b63c..18266a9a2c 100644
--- a/src/corelib/kernel/qcoreapplication.h
+++ b/src/corelib/kernel/qcoreapplication.h
@@ -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,