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. Dynamically add items to a QTreeWidget JSON
Forum Updated to NodeBB v4.3 + New Features

Dynamically add items to a QTreeWidget JSON

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 2.2k 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.
  • B Offline
    B Offline
    beowulf
    wrote on last edited by
    #1

    I have a Twitter JSON, I can manipulate it using the Qt QScriptEngine, but I wonder how to list this result in a QTreeWidget.

    Example:

    @ QString NRdata = (QString) reply->readAll();

    QScriptEngine QSengine;
    
    QScriptValue QSVResult = QSengine.evaluate(NRdata);
    
    QScriptValueIterator it(QSVResult);
    
    while (it.hasNext()) {
    
        it.next();
    
        QScriptValue entry = it.value();
    
    }@
    

    I want to put the id and name in QTreeWidget thus:

    @+---------------+--------------+
    | Id | Name |
    +---------------+--------------+
    | 1 | Beowulf |
    +---------------+--------------+
    | 2 | Sword |
    +---------------+--------------+@

    In addition to putting, I would like to know if you create a vector to store all that data.

    Example:

    @0 = { id = "1" nome = "Beowulf" }
    1 = { id = "2" nome = "Sword" }@

    -- 0x00

    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