Difference between setContextProperty and Qml registertype.

I created an UserAccessCtlr .cpp/UserAccessCtlr .h, which has methods. This method has to call from main.qml.
I had used to QQmlContext in the main.cpp to link the .cpp/.h files. Is it the right way, since I saw in sample, qmlRegistType.