A running event loop is optional and is per-thread. If you don't process events in a given thread, it doesn't need one.
invokeMethod
has no dependencies on the event loop if you invoke methods on objects that live in the thread where you call this method. If you invoke methods on objects that live in other threads, said threads will need to run the event loop, even if only periodically. They can, after all, call processEvents
at well-defined points. A cross-thread slot invocation is equivalent to posting an event to the thread's event queue.
I will check if the plugin mechanism works without a QCoreApplication
instance, but this instance doesn't hurt you any. Just create it and forget it. You don't need to run the event loop in the main thread, or in any thread for that matter.
Do note that QPluginLoader
is not the same as QLibrary
, you need to examine your needs and figure out which you want.
A non-gui QCoreApplication
can be created in an arbitrary thread, and its event loop can run there. On Windows, a QApplication
can be created in an arbitrary thread as well.