Delete a selected folder and all sub folders in QTreeView
Punit last edited by Punit
I am using QTreeView with QFilesySystemModel. How can I delete a selected folder along with all it's sub folders in QTreeView?
QModelIndex index=mytreeview->currentIndex(); dirmodel->removeRows(index.row(), index.column(), index.parent());
QFileSystemModel::rmdir is what you are looking for. Beware of the warning in the documentation.
Punit last edited by
I only want to remove folders from the QTreeview not from the file system. rmdir will remove my folder permanently from my system. @SGaist
That wasn't really clear from your original description.
In that case, use a filter. QSortFilterProxyModel for example