title: QML accessing your qml component
body: <p>I am using QML for developing a front end and I have an issue accessing a component from my main QML Window. So, my main QML window is something as:</p>
  
  <pre><code>ApplicationWindow {
      id: rootWindow
      objectName: "window"
  
      property Component mainScreen: MainScreen {} // my component
  
      // This is a slot that gets called from C++ side.
      // The function gets called fine.
      function videoDone() {
          mainScreen.doVideo()
      }
  }
  </code></pre>
  
  <p>The <code>MainScreen</code> component is written in <code>MainScreen.qml</code> file as:</p>
  
  <pre><code>ControlView {
      id: mainScreenView
      objectName: "MainScreenView"
  
  
      function doVideo() {
          console.log("Called")
      }
  }
  </code></pre>
  
  <p>However, this does not work as expected and I get the error:</p>
  
  <pre><code>TypeError: Property 'doVideo' of object QQmlComponent is not a function
  </code></pre>
  
  <p>I think the issue is that the full definition of <code>MainScreen</code> is not being seen at the ApplicationWindow level. I tried to see if I can cast it but no success.</p>
  
  <p>Also <code>mainScreen.objectName</code> returns a null string rather than <code>MainScreenView</code></p>