title: try to access qml global variable, but it reports error
body: <p>my code</p>
  
  <p><strong>AppDelegate.js</strong> for global variables</p>
  
  <pre><code>.pragma library
  
  var appDelegate= {}
  </code></pre>
  
  <p><strong>MyApp.js</strong></p>
  
  <pre><code>Qt.include("AppDelegate.js")
  
  
  
  function AppDelegate(){
  
  }
  
  
  AppDelegate.prototype.doSomething=function() {
  
  
      console.log("vvvvvvvvvvvvv")
  
  }
  AppDelegate.prototype.doSomething1=function() {
  
  
      console.log("AAAAAAAAAAAAAA")
  
  }
  //-------------------------------------------------------
  function initApp(){
  
  
      appDelegate=new AppDelegate()
      appDelegate.doSomething()
      appDelegate.doSomething1()
  
  }
  </code></pre>
  
  <p><strong>MyApp.qml</strong></p>
  
  <pre><code>import QtQuick 2.2
  import QtQuick.Controls 1.2
  import "MyApp.js" as MyApp
  
  
  ApplicationWindow {
      visible: true
      title: "System Dialogs Gallery"
      width: 580
      height: 480
  
      TabView {
          anchors.fill: parent
          anchors.margins: 8
          Tab {
              id: controlPage
              title: "File"
              FileDialogs { }
          }
  
      }
  
      Component.onCompleted: {
          MyApp.initApp()
  
      }
  }
  </code></pre>
  
  <p>it works well and output is</p>
  
  <pre><code>qml: vvvvvvvvvvvvv
  qml: AAAAAAAAAAAAAA
  </code></pre>
  
  <p>but if I call from other .js .qml file</p>
  
  <p><strong>ColorDialogs.js</strong></p>
  
  <pre><code>Qt.include("AppDelegate.js")
  
  
  
  function doit(){
  
  
  
      appDelegate.doSomething1()
  
  }
  </code></pre>
  
  <p><strong>ColorDialogs.qml</strong></p>
  
  <pre><code>import QtQuick 2.2
  import QtQuick.Controls 1.2
  import QtQuick.Dialogs 1.1
  
  import "ColorDialogs.js" as ColorDialogs
  
  
  
  Item {
  
  
      Component.onCompleted: {
  
  
          ColorDialogs.doit()
  
      }
  }
  </code></pre>
  
  <p>it reports error:</p>
  
  <pre><code>ColorDialogs.js: : TypeError: Property 'doSomething1' of object [object Object] is not a function
  </code></pre>
  
  <p>Your comment welcome</p>
  
  <p>----------------------------updated</p>
  
  <p><a href="https://i.stack.imgur.com/cRq74.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cRq74.png" alt="enter image description here"></a></p>