[PyQt] Resize columns in QTreeViewv

Hans Meine meine at informatik.uni-hamburg.de
Thu Dec 2 14:18:24 GMT 2010


Hi again!

Am 01.12.2010 um 18:22 schrieb Gionata Boccalini:
> Only a small doubt on the last fix: isn't too expensive or slow to recreate a QFileSystemModel at every signal??

Yes, it's not very nice, but obviously there's a bug in QFileSystemModel, so I resorted to this hack to reset its state.  Furthermore, there is not much state to be reused, i.e. the directory reading has to be done anyway.  The object destruction / recreation is not nice, but should not be too expensive in this case.

> Thank you again!!

You're welcome.

BTW: I noticed that you do not always use the "parent" constructor argument.  I always do, and fixed this e.g. for the views, but not yet for the models.  If you do that, you need to call sip.delete(self.__fileModel) (or self.__fileModel.deleteLater()) in order to free the memory.

HTH,
  Hans


More information about the PyQt mailing list