QFileDialog or QFileSystemModel with QTreeView
-
Hi,
I need to do a file dialog like this image !https://dl.dropboxusercontent.com/s/va85z5vv5su3ute/Capture.PNG?token_hash=AAEL8eGrHVz65EcpDyQ0-CzNhsqmMsc6nXs99LuM9Yos9g&dl=1!
But, here is my custom dialog !https://dl.dropboxusercontent.com/s/in7qqeh4nbj0430/Capture1.PNG?token_hash=AAFGufowG5qcXSzs3XxJAmqkUAFb901DsL1veL4S8nYHvg&dl=1!I am using QFileSystemModel as a model of a QTreeView. I tried to use a custom QItemModel @MultiModel *myModel = new MultiModel(this);
QFileSystemModel *fsm1 = new QFileSystemModel(this);
fsm1->setRootPath(desktop);
fsm1->setFilter(QDir::Dirs);QFileSystemModel *fsm2 = new QFileSystemModel(this);
fsm2->setRootPath(libraries);
fsm2->setFilter(QDir::Dirs);QFileSystemModel *fsm3 = new QFileSystemModel(this);
fsm3->setRootPath(home);
fsm3->setFilter(QDir::Dirs);myModel->addModel(fsm1);
myModel->addModel(fsm2);
myModel->addModel(fsm3);QTreeView *tree = ui.treeView;
tree->setModel(myModel);
tree->setSelectionMode(QTreeView::ExtendedSelection);
tree->setSelectionBehavior(QTreeView::SelectRows);
int count = myModel->columnCount(QModelIndex());
for (int i = 1; i < count; i++)
{
tree->setColumnHidden(i, true);
}@
No help at all. I am now try to use QSortFilterProxyModel but dont know how to do. Could you show me how to do this? Any help would be appreciated.