Dynamically add items to a QTreeWidget JSON



  • 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" }@


Log in to reply
 

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