title: My QFileSystemModel doesn't work as expected in PyQt
body: <p><strong>EDIT2:</strong> <code>model.hasChildren(parentIndex)</code> returns <code>True</code>, but <code>model.rowCount(parentIndex)</code> returns <code>0</code>. Is QFileSystemModel just fubar in PyQt?</p>
  
  <p><strong>EDIT:</strong> With a bit of adaptation this all works exactly as it should if I use QDirModel. This is deprecated, but maybe QFileSystemModel hasn't been fully implemented in PyQt?</p>
  
  <hr>
  
  <p>I'm learning the Qt Model/View architecture at the moment, and I've found something that doesn't work as I'd expect it to. I've got the following code (adapted from <a href="http://qt.nokia.com/doc/4.6/model-view-model.html" rel="nofollow noreferrer">Qt Model Classes</a>):</p>
  
  <pre><code>from PyQt4 import QtCore, QtGui
  
  model = QtGui.QFileSystemModel()
  
  parentIndex = model.index(QtCore.QDir.currentPath())
  print model.isDir(parentIndex) #prints True
  print model.data(parentIndex).toString() #prints name of current directory
  
  rows = model.rowCount(parentIndex)
  print rows #prints 0 (even though the current directory has directory and file children)
  </code></pre>
  
  <h1>The question:</h1>
  
  <p>Is this a problem with PyQt, have I just done something wrong, or am I completely misunderstanding QFileSystemModel? According to the documentation, <code>model.rowCount(parentIndex)</code> should return the number of children in the current directory. (I'm running this under Ubuntu with Python 2.6)</p>
  
  <p>The QFileSystemModel docs say that it needs an instance of a Gui application, so I've also placed the above code in a QWidget as follows, but with the same result:</p>
  
  <pre><code>import sys
  from PyQt4 import QtCore, QtGui
  
  class Widget(QtGui.QWidget):
      def __init__(self, parent=None):
          QtGui.QWidget.__init__(self, parent)
  
          model = QtGui.QFileSystemModel()
  
          parentIndex = model.index(QtCore.QDir.currentPath())
          print model.isDir(parentIndex)
          print model.data(parentIndex).toString()
  
          rows = model.rowCount(parentIndex)
          print rows
  
  
  def main():
      app = QtGui.QApplication(sys.argv)
      widget = Widget()
      widget.show()
      sys.exit(app.exec_())
  
  
  if __name__ == '__main__':
      main()
  </code></pre>