Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Parse QML to QVariant?
Forum Updated to NodeBB v4.3 + New Features

Parse QML to QVariant?

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 659 Views 1 Watching
  • 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.
  • W Offline
    W Offline
    wooyay
    wrote on last edited by
    #1

    Hi all,
    I have a number of quite complicated QVariant structures. Like this:

    QVariantMap booster1;
    booster1["power"] = 10;
    booster1["dir"] = 45;
    QVariantMap booster2;
    booster2["power"] = 10;
    booster2["dir"] = -45;

    QVariantList boosters;
    boosters.push_back(booster1);
    boosters.push_back(booster2);
    QVariantMap spaceship;
    spaceship["boosters"] = boosters;

    (This is just an example).

    I am getting really confused because I have to define everything backwards.

    Instead I would like to write it in QML syntax:

    spaceship : {
    boosters : [
    { power : 10,
    dir : 45
    },
    { power : 10,
    dir : -45
    }
    ]
    }

    Is there a parser or something that takes QML as input and returns me a QVariant?
    Any tips on writing one?
    I think this is a quite useful feature

    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