[Interest] Android: WARNING: QApplication was not created in the main() thread.

Thiago Macieira thiago.macieira at intel.com
Mon Dec 5 21:44:27 CET 2016


Em segunda-feira, 5 de dezembro de 2016, às 14:27:01 PST, maitai escreveu:
> Hello,
> Can you explain what is the bad thing about having this message?

It's a warning from Qt. That should be enough reason. ALL Qt warnings are bugs 
in your application. You should develop with QT_FATAL_WARNINGS set to 1 and fix 
all warnings you get.

I will not speculate how bad this particular one might be. You've been 
properly warned that it is bad. You can continue at your own risk (read: we 
won't help you until you fix this).

> BTW I had this message since a long time, since this thread I have
> removed some global QObject declarations in my main, and the message is
> gone. But it's not clear to me if it's any better and why.

Global constructors creating QObjects mean that your *real* main() thread is 
the Qt main thread. It's usually not a problem to have them, though I advise 
against.

The problem is if you create QGuiApplication in another thread.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list