title: Two way connection between QML/QtQuick and QWidget
body: <p>I am trying to make an app that would use QSerialPort and QtQuick so I need to connect desktop-like app to QML somehow.
  I managed to (ok i copied and made some changes) send information from QML to main.cpp but I can't send anything the other way.
  The wanted effect is to manage everything from .cpp, add and delete ListElements and send parameters to draw a graph.</p>
  
  <pre><code>main.cpp
  int main(int argc, char *argv[]) {
      QApplication app(argc, argv);
      QQuickView view(QUrl::fromLocalFile("path/main.qml"));
      QObject *item = view.rootObject();
      MyClass myClass,mySecondClass;
      QObject::connect(item, SIGNAL(qmlSignal(QVariant)),
                       &amp;myClass, SLOT(cppSlot(QVariant)));
      QObject::connect(&amp;myClass, SIGNAL(Nazwa(QVariant)),
                       item, SLOT(onNazwa(QVariant)));
      QVariant c=200;
      emit myClass.Nazwa(c);
  
      view.show();
      return app.exec();
  }
  </code></pre>
  
  <p>myclass.h</p>
  
  <pre><code>#ifndef MYCLASS_H
  #define MYCLASS_H
  #include &lt;QObject&gt;
  #include &lt;QDebug&gt;
  #include &lt;QQuickItem&gt;
  class MyClass : public QObject
  {
      Q_OBJECT
  public:
      explicit MyClass(QObject *parent = 0);
  
  signals:
      void Nazwa(QVariant a);
  
  public slots:
      void cppSlot(const QVariant &amp;v) {
         qDebug() &lt;&lt; "QVariant :):" &lt;&lt; v;
  
         QQuickItem *item =
             qobject_cast&lt;QQuickItem*&gt;(v.value&lt;QObject*&gt;());
         qDebug() &lt;&lt; "Wymiary:" &lt;&lt; item-&gt;width()
                  &lt;&lt; item-&gt;height();
      }
  
  };
  
  #endif // MYCLASS_H
  </code></pre>
  
  <p>main.qml</p>
  
  <pre><code>import QtQuick.Window 2.0
  import QtQuick 2.0
  
  Item {
      id: item
      width: 100; height: 100
  //    Item{
  //        id: item2
  //        onNazwa: {    }
  //    }
      signal qmlSignal(var anObject)
      MouseArea {
          anchors.fill: parent
          onClicked: {
              parent.width=200;
              item.qmlSignal(item)
          }
      }
  }
  </code></pre>
  
  <p>Also any changes to main.qml would break the 1st connection and I don't even know why. Can You give me some advise or an example? I spent 2nd day on Qt Documentation and I still can't do it :(</p>