title: QML signal and slot between 2 different QML
body: <p>I need to perform some actions in let's say main.qml according to button press in button.qml. Button inside of the button QML is inside of some custom object. Let's give it a name customObject. So customObject in button.qml looks like this:</p>
  <pre><code>customObject {
  id:trialObject
  signal backPagePressed()
  
  Button {
  id:button1
  MultitouchArea {
  onPressed:
  {
     trialObject.backPagePressed()
  }
  </code></pre>
  <p>Now when I press the button, it emits <code>backPagePressed()</code>. My question is: How can I make a slot for this signal in main QML? I'm familiar to signal and slot mechanism in C++, but that does not work for QML. I made something like this in main.qml:</p>
  <pre><code>Loader 
  {
    id:pageLoader
    onBackPagePressed:
  {
    pageLoader.source =&quot;&quot;
  }
  }
  </code></pre>
  <p>That part needs to delete the Loader's source so that it will go back to page before. However, I'm not sure about <code>onBackPagePressed:</code> ... How can I connect my signal <code>backPagePressed</code>, to the related part in my loader?</p>