QTreeView and node's expanding



  • I have a custom model and a tree inherited from QTreeView. After a loading of data I need expand some nodes. I do it from mainWidget as

    treeView.expand(index)
    

    Work fine. But volume of data grows and iterate all tree take a time. Now I am looking for how insert function of expanding to a treeView or delegate. I mean when the treeView start loading a data from model, the node will expanded or not depends of property of item.
    somethig like

    some event(QModelIndex index) {
       Item *item = index.internalPointer();
       if (item.flag() == 2)
          this->expand(index);
    }
    

    Could anybody direct me what even/slot/function/solution I could use in QTreeView. This function I need just at the start of application. I mean when treeView->setModel(model) is occur


Log in to reply
 

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