Good morning,
I’m interested in adding C++ objects that can be instantiated from a script but I’m not sure how it works when combined with QtQuick.
I’m trying to use the Q_SCRIPT_DECLARE_QMETAOBJECT macro and scriptValueFromQMetaObject<>() method to create newable script objects.
My main creates a QQuickView() object.
That object contains an engine() method that returns a QQmlEngine which inherits from QJSEngine.
The scriptValueFromQMetaObject method is derived from QScriptEngine() not QJSEngine.
I don’t see an equivalent of scriptValueFromQMetaObject in QJSEngine.
Is there a way to ‘register’ my C++ class with QJSEngine? I assume I have to use the javascript engine associated with the QML view. That way the class will be available in the script context associated with the QML code.
Thanks!
↧