The texteditor example that ships with the SDK shows you how to do this, basically you register your C++ back end like:
@
qmlRegisterType<DocumentHandler>("org.qtproject.example", 1, 0, "DocumentHandler");
@
Then derive your class from QObject, and use Q_PROPERTY:
@
Q_PROPERTY(QQuickItem *target READ target WRITE setTarget NOTIFY targetChanged)
@
To access the code from QML.
There are other methods of doing this, but this one is how they coded this example.
"Interacting with QML Objects from C++":http://qt-project.org/doc/qt-5/qtqml-cppintegration-interactqmlfromcpp.html
"Exposing Attributes of C++ Types to QML":http://qt-project.org/doc/qt-5/qtqml-cppintegration-exposecppattributes.html
What method is best practice or will be the latest and longest supported method is what I would like to know, the lack of documentation and examples is not helping matters much.