title: Not able to connect a c++ signal to a slot in QML
body: <p>Hi Everyone i have a foo class
  Code in Foo.h</p>
  
  <pre><code>Class Foo : public QObject
  {
      static Foo* Get(); // Singleton Pattern
  
      Q_INVOKABLE int addFoo();
  
  signals:
      void fooAdded(int index);
  
  public slots:
  
  private:
      QList&lt;QString&gt; m_fooArray;
  }
  </code></pre>
  
  <p>Code in foo.cpp</p>
  
  <pre><code>int Foo::addFoo()
  {
      QString newString = "blah.."
      m_fooArray.append(newString);
  
      emit fooAdded(m_fooArray.size()-1);
  
      return m_fooArray.size()-1;
  }
  </code></pre>
  
  <p>in my main function code is </p>
  
  <pre><code>{
      Foo fooInstance;
      qmlRegisterType&lt;GUI::Foo&gt;("xxx", 1, 0, "Foo");
      engine.rootContext()-&gt;setContextProperty("fooInstance", &amp;fooInstance);
  }
  </code></pre>
  
  <p>Now i have two xml main.xml and fooTabView.qml</p>
  
  <p>in main.xml code is</p>
  
  <pre><code> import QtQuick 2.3
   import QtQuick.Controls 1.2
   import xxx 1.0
  
  ApplicationWindow {
      id: appWindow
      visible: true
      width: 640
      height: 480
  
      FooTabView {
          anchors.left: parent.left
          anchors.top: parent.top
          anchors.margins: 50
      }
  
      Button {
          id: addFoo
          x: 50
          y: 59
          text: qsTr("Add Connection")
          onPressedChanged:  fooInstance.addFoo();
      }
  }
  </code></pre>
  
  <p>Now when i compile and debug when i click on the addFoo button my breakpoint in addFoo() function gets hit and the signal fooAdded(index) is emitted</p>
  
  <p>and in my FooTabView.qml i have the below code</p>
  
  <pre><code>     import xxx 1.0
       .....
  
       .....
       Foo.onFooAdded: 
       {
       .....
       }
  </code></pre>
  
  <p>But now when i compile and debug i get no error but my breakpoint inside Foo.onFooAdded never get hits.</p>
  
  <p>What i basically want is that when i hit that button a new foo get added to the list and than i will have my logic to create a new tab inside <code>Foo.onFooAdded { ... }</code></p>
  
  <p>Can someone please tell me what i am missing or doing wrong and how can i connect the fooAdded(index) signal to onFooAdded inside QML.</p>
  
  <p>please note i have also tried the below code also inside FooTabView.xml but still my breakpoint did not got hit</p>
  
  <pre><code>Connections {
      target: fooInstance
      onFooAdded: {
      ...
      }
  }
  </code></pre>
  
  <p>I think i somehow have to connect to fooInstance::onFooAdded and not Foo::onFooAdded but i get compile error if i change to fooInstance::onFooAdded</p>
  
  <p>Thanks in Advance</p>