Ok, I am still learning Qt4 and trying to understand how to do things correctly, or as correct as they can be.

Here is my situation. I want to make use of QDirModel, but it doesn't have everything that I need, so I made an inherited class, MyDirModel.

MyDirModel adds a few extra columns to QDirModel on population.

Then I have a couple of QAbstractProxyModels because I want to display the data differently. I have a FolderTreeProxyModel and a FolderListTreeProxyModel. One displays only a few columns and folders only the other displays all columns and files and folders.

Finally I have two custom QTreeView classes. FolderTree and FolderListTree. Which I set the model FolderTreeProxyModel and FolderListProxyModel respectively.

Now here's where I am not sure if I am doing this correctly or not. How do I reference indexes from MyDirModel, do I have to reimplement all the sorting searching loading functions?

Example:
Qt Code:
  1. ...
  2. connect(folderTreeView, SIGNAL(clicked(QModelIndex)), this, SLOT(setRootIndex(QModelIndex)));
  3.  
  4. ...
  5.  
  6. void mainwindow::setRootIndex(QModelIndex index)
  7. {
  8. QModelIndex dir = index.sibling(index.row(), 0);
  9.  
  10. if (!myDirModel->isDir(dir))
  11. {
  12. dir = dir.parent();
  13. }
  14.  
  15. if (dir != folderListTree->rootIndex() && myDirModel->isDir(dir))
  16. {
  17. folderListTree->setCurrentIndex(index);
  18. folderListTree->setCurrentIndex(index);
  19. lineEdit->setText(myDirModel->filePath(dir));
  20. }
  21. }
To copy to clipboard, switch view to plain text mode 

This won't work because the index is from MyDirModel? I am kinda confused on this abstraction process any ides/suggestions would be greatly appreciated!

-KW