Important: Please read the Qt Code of Conduct -

Customizing QFileDialog

  • Hi, I'm developing a desktop application, and I'd like to customize the QFileDialog to add some columns (for example, the amount of disk space used within a directory, and perhaps some indicator regarding the presence of a file in the directory indicating that some type of processing has been performed on the data in the directory...).

    I haven't been able to find much about this on this or other forums. Is this possible without completely rolling my own dialog? Any examples or code snippets would be greatly appreciated.


  • @bday1223 you may want to take a look at this blog post.

  • @bday1223
    I could be wrong (it has been known to happen!), but I do not think you can do this (without writing your own).

    QFileDialog has two implementations you can choose from: "native" or "Qt". "Native" means it uses the Windows/Linux/MacOS OS's own dialog, and that does whatever it does. "Qt"/non-native means it uses a shared Qt implementation, common across all OSes, and that has been designed to do what it does to cover similar-ish features to the native one, and that's that.

  • @Pablo-J.-Rogina
    Your blog post link just takes me back to this current page?

  • @JonB good catch, link edited now. And it looks you're wrong here :-) (as you predicted) since the QFileDialog class can be customized by means of a proxy model.

  • @Pablo-J.-Rogina
    Hmm, fair enough! The customization is only for the Qt dialog, not the native one, so you have to be prepared to use that. The post code also ends with:

    I cannot choose a file anymore. I can select a file, but no file is displayed in the "File Name" QLineEdit and the "OK" Button is disabled.

    So I hope that was settled via:

    Maybe also needs to implement mapFromSource/mapToSource?

Log in to reply