What's the alternative of api 'hasPendingEvents'?
-
QCoreApplication::hasPendingEvents and QAbstractEventDispatcher::hasPendingEvents are deprecated. So is there any alternative of that api?
-
@Samuel-Xue said in What's the alternative of api 'hasPendingEvents'?:
QCoreApplication::hasPendingEvents
Neither Qt5 not Qt6 have such a method. Same for QAbstractEventDispatcher::hasPendingEvents.
-
@Zuuka
I think it was obsoleted perhaps throughout Qt5, so really only existed at Qt4?
The simple answer is that whether there are "pending events" or not is an internal Qt detail to which you have no access and should not need to use. The natural answer is "just don't use anything like this". Why should you really need to? -
@Zuuka said in What's the alternative of api 'hasPendingEvents'?:
can i query if it is blocked?
Why? As I said: as long as your code is doing something (like a slot being executed) the event loop is blocked (means: it can't process events). There is no need to query anything.
-
Hi,
Out of curiosity, are you using QTest ?
-
@Zuuka said in What's the alternative of api 'hasPendingEvents'?:
hat all events have been processed before continuing with the cleanup.
What exact events?
-
Ok - why are they important? If they are that important then you also have to check for them in the first place. Use an event filter for example.