title: (UPDATE) QT QML 5.6 - What causes this warning "QApplication was not created in the main() thread"?
body: <p>[UPDATE] OK, I am updating my previous question. At first I thought the warning pops up when I remove <code>widgets</code> from the .pro file - which would have been peculiar behavior. After digging down, I ended up with a completely empty application and the problem still persists. My application looks like this:</p>
  
  <pre><code>#include &lt;QApplication&gt;
  
  int main(int argc, char *argv[])
  {
      QApplication app(argc, argv);
  
      return app.exec();
  }    
  </code></pre>
  
  <p>Based on other posts with the similar kind of problem, I learnt that <code>QApplication</code>needs to be the first thing to be initialized. In this case there is NOTHING else in the application. How is this warning still popping up?</p>
  
  <p><code>W/ (16992): (null):0 ((null)): WARNING: QApplication was not created in the main() thread.</code></p>
  
  <p>I am compiling the application directly on my Android device using the <code>Android for x86 (GCC 4.9, Qt 5.6.0)</code> kit.</p>
  
  <p>---- OLD QUESTION\Start ----</p>
  
  <p>Currently developing an Android app based on Qt 5.6 (C++ and QML). As the UI is based on QtQuick, I removed 'widgets' from the pro.file.</p>
  
  <pre><code>QT += core qml quick widgets network svg xml gui    
  </code></pre>
  
  <p>this lead to the warning:</p>
  
  <pre><code>WARNING: QApplication was not created in the main() thread.    
  </code></pre>
  
  <p>and also... as soon as i instantiate QQmlEngine in main() (of course after creating QApplication) this warning is also shown:</p>
  
  <pre><code> QObject: Cannot create children for a parent that is in a different thread.
  (Parent is QQmlDebuggerServiceFactory(0x65fffcd0), parent's thread is QThread(0x5d449f10), current thread is QThread(0x65183000)    
  </code></pre>
  
  <p>Apparently, the application starts in another thread? and main() in another? as soon as I put 'widgets' in the .pro file, both errors did not show up anymore. I dont really get the correlation between the two things. <em>P.S. not really relevant at this stage of the program but i am also not creating any new threads in my application.</em>
  This is how my main() looks like:</p>
  
  <pre><code>int main(int argc, char *argv[])
  {
     QApplication app(argc, argv);
  
     qmlRegisterUncreatableType&lt;MainFrame&gt;("PSGApp", 1, 0, "MainFrame", "");
  
     MainFrame m_MainFrame;
     QQmlEngine engine;
  
     engine.rootContext()-&gt;setContextProperty("q_MainFrame",             &amp;m_MainFrame);
     engine.rootContext()-&gt;setContextProperty("Ctr",                     m_MainFrame.c());
     engine.rootContext()-&gt;setContextProperty("Dev",                     m_MainFrame.c()-&gt;dev());
     engine.rootContext()-&gt;setContextProperty("Def",                     m_MainFrame.c()-&gt;dev()-&gt;_def());
     engine.rootContext()-&gt;setContextProperty("ModelUdpDevices",         m_MainFrame.UdpDevices());
     engine.rootContext()-&gt;setContextProperty("ModelDashboardDevices",   m_MainFrame.DashboardDevices());
     engine.rootContext()-&gt;setContextProperty("ModelZones",              m_MainFrame.c()-&gt;dev()-&gt;_DevZones());
     engine.rootContext()-&gt;setContextProperty("ModelRGParameter",        m_MainFrame.c()-&gt;dev()-&gt;RegelParameter());
     engine.rootContext()-&gt;setContextProperty("ModelSYSParameter",       m_MainFrame.c()-&gt;dev()-&gt;SysParameter());
     engine.rootContext()-&gt;setContextProperty("ModelKOMMParameter",      m_MainFrame.c()-&gt;dev()-&gt;KommParameter());
  
     QObject::connect(&amp;app, SIGNAL(applicationStateChanged(Qt::ApplicationState)), &amp;m_MainFrame, SLOT(applicationStateChanged(Qt::ApplicationState)));
     QObject::connect(&amp;engine, SIGNAL(quit()), &amp;app, SLOT(quit()));
  
     QQmlComponent component(&amp;engine,QUrl(QStringLiteral("qrc:/qml/main.qml")));
     component.create();
  
     return app.exec();
  }    
  </code></pre>
  
  <p>---- OLD QUESTION\End ----</p>