Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. When using QVariant with custom user type before QQmlEngine is created once, QVariant's get sent to c++ with different types.
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 295 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    theonlylawislove
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved