#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QFileSystemModel>
#include <QTreeView>
#include <QListView>
#include <QDir>
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
private:
QTreeView * treeview;
// QListView *listview;
QFileSystemModel *model;
};
#endif // MAINWINDOW_H
#include "mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
treeview=new QTreeView(this);
//listview=new QListView(this);
setCentralWidget(treeview);
model=new QFileSystemModel(this);
model->setRootPath(QDir::currentPath());
treeview->setModel(model);
treeview->setRootIndex(model->index(QDir::currentPath()));
}