//main.cpp
#include <QtGui/QtGui>
#include <QtGui/QDirModel>
#include <QtGui/QListView>
#include <QtGui/QTableView>
#include <QtGui/QTreeView>
int main(int argc, char *argv[])
{
QApplication app(argc,argv);
QFileSystemModel model; //如果用QDirModel model; 展开树时,太慢
//QListView list;
QTreeView tree;
QTableView table;
QSplitter* spliter = new QSplitter;
//model.setRootPath("");
model.setRootPath("");
//model.setRootIndex();
tree.setModel(&model);
//list.setModel(&model);
table.setModel(&model);
//tree.setSelectionMode(QAbstractItemView::MultiSelection);
tree.setSelectionMode(QAbstractItemView::SingleSelection);
//list.setSelectionMode(tree.selectionMode());
table.setSelectionMode(tree.selectionMode());
//QObject::connect(&tree,SIGNAL(doubleClicked(QModelIndex)),&list,
// SLOT(setRootIndex(QModelIndex)));
QObject::connect(&tree,SIGNAL(clicked(QModelIndex)),&table,
SLOT(setRootIndex(QModelIndex)));
spliter->addWidget(&tree);
//spliter->addWidget(&list);
spliter->addWidget(&table);
spliter->show();
return app.exec();
}