can anyone tell why this program is not working?
am not able to see the directory structure.
(from the printf's i could make out that is is not calling parent and data functions. this code doesnt contains printfs)

Qt Code:
  1. #include <QtGui>
  2.  
  3. class TestModel : public QAbstractItemModel
  4. {
  5. public:
  6. QDirModel *model;
  7. TestModel()
  8. {
  9. model = new QDirModel();
  10. }
  11.  
  12. QVariant data(const QModelIndex &index, int role) const
  13. {
  14. return model->data(index, role);
  15. }
  16.  
  17. QModelIndex index(int row, int column, const QModelIndex &parent) const
  18. {
  19. return model->index(row, column, parent);
  20. }
  21.  
  22. QModelIndex parent(const QModelIndex &index) const
  23. {
  24. return model->parent(index);
  25. }
  26.  
  27. int rowCount(const QModelIndex &parent) const
  28. {
  29. return model->rowCount(parent);
  30. }
  31.  
  32. int columnCount(const QModelIndex &parent) const
  33. {
  34. return model->columnCount(parent);
  35. }
  36. };
  37.  
  38. int main(int a, char** b)
  39. {
  40. QApplication app(a, b);
  41. TestModel *mod = new TestModel;
  42. QTreeView view;
  43. view.setModel(mod);
  44. view.show();
  45. return app.exec();
  46. }
To copy to clipboard, switch view to plain text mode 

Thanks