QTreeWidget and QFileSystemModel

1.2k views Asked by At

Please tell me how to connect to QFileSystemModel QTreeWidget simply function SetModel() not support QFileSystemModel but only QAbstractItemModel, but I need to work with files and for these purposes QAbstractItemModel not fit, I would like to open files in directories climb QTreeWidget. Thanx

1

There are 1 answers

0
noOne On

setModel is a private function in QTreeWidget. To use it, you could create a custom TreeWidget class that inherits QtreeWidget and QTreeView, create a public function setModel(QAbstractItemModel *model) and in it call the QTreeView setModelfunction like so:

 TreeView::setModel(QAbstractItemModel *model){
      QTreeView::setModel(model); 
 }