Hi Volker,
our public APIs only include the option to use the NativeUtils object from the QML context.
It is possible to retrieve and work with the object from the context also from C++. However, as we do not provide public headers for the NativeUtils class at the moment, I suggest to rather call the features from QML with a QQmlExpression.
To do so, you can e.g. pass your QQmlApplicationEngine from main.cpp to the respective component you want to run QML code from. You can then use this it to e.g. retrieve the connectionType from our QML API:
QString MyCppClass::getConnectionType() {
// requires access to root context of QQmlApplicationEngine object
QQmlExpression *expr = new QQmlExpression(engine->rootContext(), 0, "nativeUtils.getConnectionType()");
QString result = expr->evaluate().toString();
delete expr;
return result;
}
If your C++ class is a QML item you can also retrieve the engine from the item context like this:
// requires e.g. object reference o QML item
QQmlEngine *ownerEngine = QQmlEngine::contextForObject(quickItem)->engine();
Hope this helps!
Best,
Günther