summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-09-07 11:28:17 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-10-30 12:32:29 +0000
commit56410a51cc897e3b38a0794019ebf196b1eb22d5 (patch)
tree9ff5a6b262ea7bfe3a9ea7c8a4015dedf9ce0301 /src
parent00b2e45a97205975ee91aa43f00e3dbef1a8907b (diff)
Clarify behavior of QCoreApplication::processEvents
The overload that takes a maxtime (now duration) was buggy, but we can't change its behavior, so instead we clarify what it actually does. Change-Id: I8a04fbaea5847c95b6ec6e73396304ab4debd35b Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 463e30e1c3..965d65fb5d 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -1266,7 +1266,11 @@ bool QCoreApplication::closingDown()
\l{QCoreApplication::sendPostedEvents()}{sendPostedEvents()} from
within that local loop.
- Calling this function processes events only for the calling thread.
+ Calling this function processes events only for the calling thread,
+ and returns after all available events have been processed. Available
+ events are events queued before the function call. This means that
+ events that are posted while the function runs will be queued until
+ a later round of event processing.
\threadsafe
@@ -1283,7 +1287,7 @@ void QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags)
/*!
\overload processEvents()
- Processes pending events for the calling thread for \a maxtime
+ Processes pending events for the calling thread for \a ms
milliseconds or until there are no more events to process,
whichever is shorter.
@@ -1292,11 +1296,14 @@ void QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags)
Calling this function processes events only for the calling thread.
+ \note Unlike the \l{QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags)}{processEvents()}
+ overload, this function also processes events that are posted while the function runs.
+
\threadsafe
\sa exec(), QTimer, QEventLoop::processEvents()
*/
-void QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags, int maxtime)
+void QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags, int ms)
{
// ### Qt 6: consider splitting this method into a public and a private
// one, so that a user-invoked processEvents can be detected
@@ -1307,7 +1314,7 @@ void QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags, int m
QElapsedTimer start;
start.start();
while (data->eventDispatcher.load()->processEvents(flags & ~QEventLoop::WaitForMoreEvents)) {
- if (start.elapsed() > maxtime)
+ if (start.elapsed() > ms)
break;
}
}