It appears that QDirModel uses rows to store directory entries, which means that columns are not useful at all. So I have a simple hierarchy:
Qt Code:
  1. ls -R
  2.  
  3. A C
  4.  
  5. ./A:
  6. B
  7.  
  8. ./A/B:
  9.  
  10. ./C:
To copy to clipboard, switch view to plain text mode 
If I run the following code to browse the hierarchy:
Qt Code:
  1. void
  2. MyClass::Browse(QModelIndex idx, int indent)
  3. {
  4. QFileInfo info = this->fileInfo(idx);
  5. for (int i=indent ; i>0 ; i--)
  6. this->Print(" \r");
  7. this->Print("%d %d %s", idx.row(), idx.column(), info.fileName().toAscii().constData());
  8. for (int i=0 ; idx.child(i, 0).isValid() ; i++)
  9. this->ComputeSizes(idx.child(i, 0), indent+2);
  10. }
To copy to clipboard, switch view to plain text mode 
I get the expected output:
Qt Code:
  1. MyClass: 38 0 test
  2. MyClass: 0 0 A
  3. MyClass: 0 0 B
  4. MyClass: 1 0 C
To copy to clipboard, switch view to plain text mode 
But if I change the code so as to browse columns rather that rows as follow:
Qt Code:
  1. void
  2. MyClass::Browse(QModelIndex idx, int indent)
  3. {
  4. QFileInfo info = this->fileInfo(idx);
  5. for (int i=indent ; i>0 ; i--)
  6. this->Print(" \r");
  7. this->Print("%d %d %s", idx.row(), idx.column(), info.fileName().toAscii().constData());
  8. for (int i=0 ; idx.child(0, i).isValid() ; i++)
  9. this->ComputeSizes(idx.child(0, i), indent+2);
  10. }
To copy to clipboard, switch view to plain text mode 
I get an unexpected output:
Qt Code:
  1. MyClass: 38 0 test
  2. MyClass: 0 0 A
  3. MyClass: 0 0 B
  4. MyClass: 0 1 B
  5. MyClass: 0 2 B
  6. MyClass: 0 3 B
  7. MyClass: 0 1 A
  8. MyClass: 0 2 A
  9. MyClass: 0 3 A
To copy to clipboard, switch view to plain text mode 
I would have expected that idx.child(0, i>0) be unvalid!

I have one more question: what is the difference between QDirModel::sibling() and QDirModel::child()?