From 47778847ec103242ee95b01d502272d6a9879e9b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 19 Nov 2020 10:32:02 -0800 Subject: [PATCH] QCoreApplication: add doc to discourage use of processEvents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If51855da004b4f3fbf43fffd1648fc580c00224a Reviewed-by: Giuseppe D'Angelo Reviewed-by: Topi Reiniƶ --- src/corelib/kernel/qcoreapplication.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 7c2cdd7516a..8dc57c3a195 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1231,8 +1231,10 @@ bool QCoreApplication::closingDown() Processes some pending events for the calling thread according to the specified \a flags. - You can call this function occasionally when your program is busy - performing a long operation (e.g. copying a file). + Use of this function is discouraged. Instead, prefer to move long + operations out of the GUI thread into an auxiliary one and to completely + avoid nested event loop processing. If event processing is really + necessary, consider using \l QEventLoop instead. In the event that you are running a local loop which calls this function continuously, without an event loop, the @@ -1268,8 +1270,10 @@ void QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags) milliseconds or until there are no more events to process, whichever is shorter. - You can call this function occasionally when your program is busy - doing a long operation (e.g. copying a file). + Use of this function is discouraged. Instead, prefer to move long + operations out of the GUI thread into an auxiliary one and to completely + avoid nested event loop processing. If event processing is really + necessary, consider using \l QEventLoop instead. Calling this function processes events only for the calling thread.