qmlRegisterType :
"Sometimes a QObject-based class may need to be registered in a QML type system, but not as an instance of the type."
Use qmlRegisterType if you want to reuse a QObject-based class in one or more qml files with a different property. QML is responsible for initializing this register class.
For more help. Defining QML types from C ++
setContextProperty :
Use setContextProperty if you want to use one global class to access or from QML. Here you need to create this class object before using setContextProperty ().
Note. Since all expressions evaluated in QML are evaluated in a specific context, if the context is changed, all bindings in this context will be redefined. Therefore, context properties should be used with caution outside of application initialization, as this can lead to poor application performance.
For more help. Embedding C ++ Objects in QML
source share