I've created a Qt-based network library for use with applications that are not running a Qt event loop, and which are not necessarily otherwise Qt applications. This was made possible by creating a QCoreApplication
instance in a thread per the answer from Is it possible to create local event loops without calling QApplication::exec()?
This works perfectly, but it makes Qt upset (I presume it's worried that I'll try to manipulate a GUI outside of the main thread which wouldn't work, but I'm not), and so it prints a warning: WARNING: QApplication was not created in main() thread
.
I'd like to suppress that warning which will otherwise be printed to the X11 console and most likely cause my users to enter a bunch of needless deficiencies. However, I'd like to just supress THIS error, as I use qDebug
for some legitimate purposes and want to see future warnings. Is there a way to do this, like some kind of Qt #pragma
?
EDIT:
A similar question was asked before here: Qt console application "WARNING: QApplication was not created in the main() thread", but the answer was basically just a code review without any meaningful ideas to suppress the warning.
QCoreApplication
thread is itself aQObject
because it needs to use signals to communicate with sockets in child threads. – Danelaw