When using QVariant with custom user type before QQmlEngine is created once, QVariant's get sent to c++ with different types.



  • I am generating bindings for .NET Core (see here).

    When I pass a QJsValue to a C++ method (with QVariant), the userType() is correct.

    obj.TestMethod({
      "test": 23
    }
    
    void TestMethod(QVariant value) {
       // userType is expected to be ```QJsValue```
    }
    

    However, If I use QVariant with a custom struct before QQmlApplicationEngine, then with the same call above, the QVariant's userType is my custom struct, instead of QJsValue.

    QQmlApplicationEngine is obviously doing some initialization stuff that should be done immediately in my application to prevent errors if someone does some stuff with my bindings before the QQmlApplicationEngine is created. The question is, how do I force that initialization stuff to happen manually, without creating a QQmlApplicationEngine? Or, maybe there is another way to solve this problem.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.