35 lines
796 B
C++
35 lines
796 B
C++
#include "directory.h"
|
|
#include "ui_directory.h"
|
|
|
|
directory::directory(QWidget *parent) :
|
|
QDialog(parent),
|
|
ui(new Ui::directory)
|
|
{
|
|
ui->setupUi(this);
|
|
|
|
QString sPath = "T:/";
|
|
dirmodel = new QFileSystemModel(this);
|
|
dirmodel->setFilter(QDir::NoDotAndDotDot | QDir::AllDirs);
|
|
dirmodel->setRootPath(sPath);
|
|
ui->treeView->setModel(dirmodel);
|
|
|
|
filemodel = new QFileSystemModel(this);
|
|
filemodel->setFilter(QDir::NoDotAndDotDot | QDir::AllDirs);
|
|
filemodel->setRootPath(sPath);
|
|
|
|
ui->listView->setModel(filemodel);
|
|
}
|
|
|
|
directory::~directory()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
|
|
void directory::on_treeView_clicked(const QModelIndex &index)
|
|
{
|
|
QString sPath = dirmodel->fileInfo(index).absoluteFilePath();
|
|
ui->listView->setRootIndex(filemodel->setRootPath(sPath));
|
|
|
|
}
|