Imo, it should be possible (if only for logging/tracing purposes) to get information about a QThread's event queue size.
It's possible to get the size of the postEventList for a particular thread using the following snippet:
#include <QThread>
#include <private/qthread_p.h>
int getEventQueueSize(QThread* thread)
{
auto threadData = QThreadData::get2(thread);
QMutexLocker locker(&threadData->postEventList.mutex);
return threadData->postEventList.size();
}
You need to take special care w.r.t. the used include paths, because the paths to private/qthread_p.h and private/qobject_p.h need to be provided. So in addition to the usual includes, you need to add:
g++ ... -isystem /usr/include/qt5/QtCore/5.7.1/QtCore ...
Disclaimer: Use at your own risk. Since this touches the internals of Qt, and is probably unintended use, take extra care when using this. There may be a chance for a deadlock when the postEventList.mutex is locked (as in the above example). Also note that QVector is not threadsafe (postEventList is a QVector) and postEventList.mutex is non-recursive.