C++ (Qt) fsModel_ = new FileSystemModel(); fsModel_->setFilter(QDir::Files | QDir::Hidden);
C++ (Qt) //Представление в виде дерева fileTreeView_ = new QTreeView(); fileTreeView_->setRootIsDecorated(false); fileTreeView_->setAlternatingRowColors(true); fileTreeView_->setAnimated(false); fileTreeView_->setIndentation(20); fileTreeView_->setSortingEnabled(true); fileTreeView_->sortByColumn(0, Qt::AscendingOrder);
C++ (Qt)fileTreeView_->setModel(fsModel_);
C++ (Qt)void MainWindow::changeDirectory(const QString & newPath){ fsModel_->setRootPath(newPath); fileTreeView_->setRootIndex(fsModel_->index(newPath));}
C++ (Qt)QDirModel *model = new QDirModel;QTreeView *tree = new QTreeView(splitter);tree->setModel(model);tree->setRootIndex(model->index(QDir::currentPath()));