Hi,
I'm creating a shared library that is based on a lot of non-GUI Qt components, most notably QHttp. Since the library uses QHttp, I need to have an event loop running. The user of the shared library should be able to instantiate the library object and then continue doing whatever in their code.
I've read that I need a QCoreApplication instance to have an event loop and that QCoreApplication needs to be started from the main thread. However if I call QCoreApplication::exec() from my main thread, control never goes back to the user of the library. This doesn't give me what I want!
I've been struggling with the best way to make this work. The best I can get working is to use a QThread (without an event loop) to start QCoreApplication::exec in QThread::run(). I get a warning about QCoreApplication not being created in the main thread, but it's working.
Any ideas on a better way to implement this? Thanks!
Bookmarks