The object is to display Data in QML

I created a new QML file code above , I would like to communicate C++ class and This QML file, so I tried to use :
Qt Code:
  1. QQuickView *view= new QQuickView;
  2. QQmlContext *c = view->engine()->rootContext();
  3. c->setContextProperty("myModel", QVariant::fromValue(projects));
To copy to clipboard, switch view to plain text mode 

Is this an other way simple to do that ??