Can I determine if a thread has a QEventLoop?

I am writing a Windows DLL that can run under QApplication or can run under a regular Win32 application. I want to use Qt Networking classes that require an event loop.

If you are working in a regular Win32 application (not Qt), I have to run QThread or QEventLoop for network signals and Qt slots for operation. Note. DLL uses QtWinMigrate. But if you work in QApplication, then there will already be a cycle of events, and there is no need to start a new QThread.

Is there a way to check an existing QEventLoop?

Explanation of the DLL works under a large old code base, and the thread in which my class runs may or may not be QThread.

+4
source share
2

Qt 5.

QThread, QThread::CurrentThread. , , QApplication.

, , QThread::eventDispatcher  . NULL, Qt. , Qt 5. , .

, QThread , Qt . , QThread, , . , .

UPDATE: Qt 4 :

QAbstractEventDispatcher::instance()

. doc.

+5

QThread:

QThread . QThreads run(). run() exec() Qt .

, run, .

0

Source: https://habr.com/ru/post/1624346/


All Articles