Nominate our 2022 Qt Champions!

How to Use QFileSystemModel

  • Hi guys,

    I'm using QFileSystemModel and a view object in custom file dialog window implementation.

    My question is, from a performance stand-point, should I delete the QFileSystemModel instance when the dialog window is not visible?

    I'm wondering this because I read that QFileSystemModel actively monitors the file system and has a separate thread to do so. My thinking is, if QFileSystemModel is consuming resources "watching" the file system, then while my file dialog window is not being used perhaps it is best to destroy QFileSystemModel and recreate it when it's needed again?

    Or is it OK to leave it? What's best?


  • Leave it. (If you want to have some fun, try to delete or move the directory it is watching;)

Log in to reply