#include #include #include #include #include #include int main(int argc, char *argv[]) { QApplication a(argc, argv); QString temp = QStandardPaths::writableLocation(QStandardPaths::TempLocation); QTemporaryDir tempDir; QDir dir(tempDir.path()); dir.mkdir("(dir1)"); dir.mkdir("dir2"); QFileSystemModel* model = new QFileSystemModel(); model->setFilter(QDir::AllEntries | QDir::AllDirs); QModelIndex index = model->setRootPath(tempDir.path()); QListView* view = new QListView(); view->setModel(model); view->setRootIndex(index); view->show(); return a.exec(); }