#include "ui_dialog.h"
Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
QString sPath ="/";
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::Files);
ui->listView->setModel(filemodel);
}
Dialog::~Dialog()
{
delete ui;
}
void Dialog::on_treeView_clicked(const QModelIndex &index)
{
QString sPath = dirmodel->fileInfo(index).absoluteFilePath();
ui->listView->setRootIndex(filemodel->setRootPath(sPath));
}
Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
QString sPath ="/";
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::Files);
ui->listView->setModel(filemodel);
}
Dialog::~Dialog()
{
delete ui;
}
void Dialog::on_treeView_clicked(const QModelIndex &index)
{
QString sPath = dirmodel->fileInfo(index).absoluteFilePath();
ui->listView->setRootIndex(filemodel->setRootPath(sPath));
}