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. Iteration of contents model from treeView type...
Forum Updated to NodeBB v4.3 + New Features

Iteration of contents model from treeView type...

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 362 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.
  • jerome_isAviableJ Offline
    jerome_isAviableJ Offline
    jerome_isAviable
    wrote on last edited by
    #1

    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(!cursor.data().toString().isEmpty()) {
    //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...

    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