title: How to connect a QML signal with a C++ slot?
body: <p>I have a problem with a <code>MessageDialog</code> signal in QML. In my <code>MessageDialog</code> I have two buttons for <em>Yes</em> and <em>No</em>. I want to connect each button with a signal.
  Here is my qml file:</p>
  
  <pre><code>import QtQuick 2.2
  import QtQuick.Dialogs 1.1
  
  Item{
      MessageDialog {
          signal qmlYesSig(string msg)
          signal qmlNoSig (string msg)
          title: "Send data?"
          icon: StandardIcon.Question
          text: "Do you want to save your data on the online platform?"
          detailedText: "Click Yes "
          standardButtons: StandardButton.Yes | StandardButton.No
          Component.onCompleted: visible = true
          onYes: qmlYesSig("From yes")
          onNo: qmlNoSig("From no")
      }
  }
  </code></pre>
  
  <p>Here is my slot:</p>
  
  <pre><code>class MyClass : public QObject
  {
      Q_OBJECT
  public slots:
      void cppSlot(const QString &amp;msg) {
          qDebug() &lt;&lt; "Called the C++ slot with message:" &lt;&lt; msg;
      }
  };
  </code></pre>
  
  <p>And here is how i use this in main:</p>
  
  <pre><code>QQuickView view(QUrl::fromLocalFile("window.qml"));
  QObject *item = view.rootObject();
  AddData myClass;
  QObject::connect(item, SIGNAL(qmlSignal(QString)),
                   &amp;myClass, SLOT(cppSlot(QString)));
  
  view.show();
  </code></pre>
  
  <p>It give me the error:</p>
  
  <blockquote>
    <p>C2665: 'QObject::connect': none of the 3 overloads could convert all the argument types</p>
  </blockquote>
  
  <p>I have try many times but I can't make work QML signal and C++ slots.
  Also I have try the example from here <a href="http://doc.qt.io/qt-5/qtqml-cppintegration-interactqmlfromcpp.html" rel="noreferrer">Qt doc</a> and give me the same error.</p>
  
  <p>Can somebody give me an idea how to connect QML signal and C++ slots for a <code>MessageDialog</code>? </p>