title: New qml object added to scene in c++
body: <p>I have a problem with adding new QML object to existing scene. </p>
  
  <p>My <code>main.qml</code> source:</p>
  
  <pre><code>ApplicationWindow    
  {
  id:background
  visible: true
  width: 640
  height: 480
  }
  </code></pre>
  
  <p><code>MyItem.qml</code> source:</p>
  
  <pre><code>Rectangle 
  {
  width: 100
  height: 62
  color: "red"
  anchors.centerIn: parent
  }
  </code></pre>
  
  <p>Finally, here is my <code>main.cpp</code> source:</p>
  
  <pre><code>int main(int argc, char *argv[])
  {
      QApplication app(argc, argv);
  
      QQmlApplicationEngine engine;
      engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
  
      QQmlComponent *component = new QQmlComponent(&amp;engine);
      component-&gt;loadUrl(QUrl("qrc:/MyItem.qml"));
  
      qDebug() &lt;&lt; "component.status(): "&lt;&lt; component-&gt;status();
  
      QObject *dynamicObject  = component-&gt;create();
      if (dynamicObject == NULL) {
          qDebug()&lt;&lt;"error: "&lt;&lt;component-&gt;errorString();;
      }
  
      return app.exec();
  }
  </code></pre>
  
  <p><code>main.qml</code> appears correctly but <code>MyItem.qml</code> doesn't appear inside <code>main.qml</code>. <code>Component.status()</code> returns state <code>Ready</code>, no errors on <code>dynamicObject</code>. What am I doing wrong?</p>