Iteration of contents model from treeView type...

  • i have a QStandardItemModel *binders...
    and then, i would like to write each data content of this model inside a database table.

    Does the only one way to do it is to ge by a for loop like:

    void my_class::put_from_classeurs_toTable(const QModelIndex &parent) {
    for (int i; i< binders->rowCount(parent); i++) {
    QModelIndex cursor = binders->index(i, 0, parent);
    if(! {
    //find all columns and write data inside the table
    if(cursor->hasChild()) {
    put_from_classeurs_toTable(cursor); } // recursion for search down to the childs...
    (this is a prototype never test... so have sure wrong codes)

    or ther is an other (or more) easy way to do it ?
    also... in each row, there is a correspondance to an other model contain files/directories in a tree...

Log in to reply

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