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:
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 setModel
function like so:
TreeView::setModel(QAbstractItemModel *model){ QTreeView::setModel(model); }