You can get a QQmlEngine instance by passing a QML element to C ++, where you can use the qmlEngine method.
So, you can set the context property by calling
qmlEngine(passedQmlItem)->rootContext()->setContextProperty("propertyName", propertyValue);
source share