title: QML StackView how to push a component defined in a separate file?
body: <p>I'm experiencing some difficulty with Qt Quick 2.1 in Qt 5.9. Specifically, I'm struggling to make the StackView QML component do what I need it to do. I'm trying to push an item defined in a separate QML file with properties, here's a description of what I've done.</p>
  
  <p><strong>qml/main.qml</strong></p>
  
  <p>This contains the StackView QML component which holds the screens. The initialItem correctly displays the OverView screen, so you could say this is basically working as intended.</p>
  
  <pre><code>// import ...
  import "screens"
  
  StackView {
      id: mainView
      initialItem: OverviewScreen {}
  }
  </code></pre>
  
  <p><strong>qml/screens/OverviewScreen.qml</strong></p>
  
  <p>This is the OverView screen, which contains a GridView. When a delegate of the GridView is clicked, then I would like to initialise an instance of ItemDetailScreen with an attached property 'Id' on the GridView delegate, which is a role of the attached model.</p>
  
  <pre><code>// import ...
  import "screens"
  
  Item {
      // ...
      GridView {
          // model: ...
          delegate: Item {
              // ...
              MouseArea {
                  anchors.fill: parent
                  onClicked: {
                      mainView.push({item: ItemDetailScreen, parameters: {id: Id}}) // ERROR
                  }
              }
          }
      }
  }
  
  qml/screens/ItemDetailScreen.qml
  </code></pre>
  
  <p>This contains a variety of QML components, but it follows a familiar pattern, with Item as the root component.</p>
  
  <pre><code>// import ...
  
  Item {
      // ...
  }
  </code></pre>
  
  <p>The problem is that when the onClicked handler of the GridView delegate is executed, then I'm getting an error printed to the screen referencing the line where an ItemDetailScreen is pushed to the mainView.</p>
  
  <p>If I add a component property to the OverviewScreen like this: <code>property Component detailScreen: ItemDetailScreen {}</code> and then change the push to <code>mainView.push(detailScreen)</code> then the push succeeds and I see the screen, however I'm still not able to pass any properties, as <code>mainView.push({item: detailScreen, properties: {id: Id}})</code> also fails with an error.</p>
  
  <p>So my question really is this: What's the correct way of pushing an instance of ItemDetailScreen, with properties?</p>