killerwookie99
15th August 2008, 17:13
So this works when I don't use a QSortFilterProxyModel but when I make QTreeView use a QSortFilterProxyModel, the compiled code seg faults...
QTreeView *treeView = new QTreeView();
QDirModel *dirModel = new QDirModel();
QSortFilterProxyModel *proxyDirModel = new QSortFilterProxyModel();
proxyDirModel->setSourceModel(dirModel);
treeView->setModel(proxyDirModel);
// I have tried it both of these ways:
treeView->setRootIndex(dirModel->index("/"));
//treeView->setRootIndex(treeProxyModel->sourceModel()->index("/"));
How can I make this work? Right now it seems like having two QDirModels works without problems when I use one dirmodel and try to do this the right way I run into lots of problems and not a lot of good documentation...:eek:
QTreeView *treeView = new QTreeView();
QDirModel *dirModel = new QDirModel();
QSortFilterProxyModel *proxyDirModel = new QSortFilterProxyModel();
proxyDirModel->setSourceModel(dirModel);
treeView->setModel(proxyDirModel);
// I have tried it both of these ways:
treeView->setRootIndex(dirModel->index("/"));
//treeView->setRootIndex(treeProxyModel->sourceModel()->index("/"));
How can I make this work? Right now it seems like having two QDirModels works without problems when I use one dirmodel and try to do this the right way I run into lots of problems and not a lot of good documentation...:eek: