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

Gunnar Roth gunnar.roth at gmx.de
Mon Dec 5 23:58:22 CET 2016


> Am 05.12.2016 um 22:54 schrieb maitai <maitai at virtual-winds.org>:
> 
> 
> 
> I am just wondering why creating a 'simple' QMap (or QString, whatever) in the same main() forces qApp to be created in another thread. 
Well of course it is not, but you create a Object before the QApplication class. Your map is created before entering main, where QApplication is created.
If you need that kind of globals, try using Q_GLOBAL_STATIC, which will created the global singleton on demand in a thread-safe manner..

Regards, Gunnar Roth


More information about the Interest mailing list