HowTo: Struct -> QVariant -> QML type
I have a struct which I wanted to use in QML.
Is my understanding correct that:
I could wrap my struct in QVariant, then I could just make a similarly structured js object in QML, then pass that to c++ side.
Or am I totally wrong and I need a different approach?
I think you should wrap your struct in an QObject-derived class, and then register this class to QML engine so that you can instantiate the class in QML. You can create a method, which is callable in QML, in the class to assign values to your struct via QML code.