My code below will display the whole file system. I just want to display a subfolder (ex D:\folder1), with all it's contents.
I tried setting the root index of the treeView but this will hide the folder (only the contents of the folder1 will be shown).
I also tried using "setFilterRegExp()" and "setFilterKeyColumn()", but this approach will also NOT work because it will filter the parents as well.
I also tried subclassing the QSortFilterProxy" but that seems a little too much for what I'm trying to achieve.

Is there an easier method here?

Qt Code:
  1. int main(int argc, char *argv[])
  2. {
  3. QApplication a(argc, argv);
  4. QDirModel *model = new QDirModel();
  5. QSplitter *splitter = new QSplitter();
  6. QTreeView *leftTree = new QTreeView(splitter);
  8. proxyModel->setSourceModel(model);
  9. leftTree->setModel(proxyModel);
  11. splitter->show();
  12. return a.exec();
  13. }
To copy to clipboard, switch view to plain text mode