......
如果QSortFilterProxyModel没有经过任何设置,如何实现你的那个功能?
具体为:
继承QSortFilterProxyModel,重载bool QSortFilterProxyModel::filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const
对于层次大于3的,比如你的QDirModel中 source_parent.index(source_row, 0) 层次大于3, 也就是 source_parent 层次大于2(若source_parent有效)...则filterAcceptsRow返回FALSE,于是乎就不会在View上显示
关于你的第二个问题,
如果你的所谓目录指的是某个固定目录,可以使用QFileSystemWatcher
否则,可以定时刷新(不过效率问题...)