title: QML dynamic component creation
body: <p>I'm trying to create an instance of a QtMobility <code>MapPolyline</code> and several of <code>Coordinate</code> in QML programmaticaly from a Javascript function.</p>
  
  <p>As far as I can see the only way to create new instance from Javascript functions is to use <code>Qt.createComponent</code> and <code>Qt.createQmlObject</code>. However, I can't find a way to call <code>createComponent</code> that will work (I always get a file doesnt exist error). And I'd like to avoid <code>Qt.createQmlObject</code> since it seems like a really bad practice.</p>
  
  <p>Is there any clean way to achieve this?</p>
  
  <pre><code>Component {
      id: polyGenerator
      MapPolyline {}
  }
  
  function addPoly() {
      //This next line works, but crashes when trying to add positions
      //createPoly(polyGenerator);
  
      var component = Qt.createComponent("Rectangle");
      console.log(component.status + " " + Component.Null);
      if (component.status == Component.Ready) {
          createPoly(component);
      } else if (component.status == Component.Error) {
          console.log("Error: " + component.errorString());
      } else {
          component.statusChanged.connect(function () {
              if (component.status == Component.Error) {
                  console.log("Error: " + component.errorString());
                  return;
              }
              createPoly(component);
          });
      }
  }
  
  function createPoly(component) {
      var poly = component.createObject(map);
  
      poly.border.color = "red";
      poly.border.width = 4;
  
      // I get a crash here, my guess is that I need proper Coordinate objects
      poly.addCoordinate({latitude: -34.60553, longitude: -58.38088});
      poly.addCoordinate({latitude: -34.60720, longitude: -58.38081});
      poly.addCoordinate({latitude: 34.60720, longitude: -58.38081});
      poly.addCoordinate({latitude: -34.60597, longitude: -58.37930});
  
      map.addMapObject(poly);
  }
  </code></pre>