Please nominate your Qt Champions for 2021!

[Solved] [v4.7.2] Set default directory of QFileDialog to "My Computer"/List drives?

  • Hi!

    Is there a way to set the default directory of a QFileDialog to "My Computer" (preferably with QFileDialog::getExistingDirectory())?

    What I actually want to achieve is that a list of drives are shown initially.
    When I set "dir" to "...", all drives are shown on the right side, but the path "Search in: " is not updated to "My Computer" (it is still the current dir of the program). So I don't really rely on this behavior...

    So what could I try?

  • try this:
    @QFileDialog dlg;

    "How to display Windows Explorer objects in one command-line":

  • Thank you, this works!

    Now I remember this CLSID stuff. This won't work for win vista/7, right?
    Although I'm developing for win xp only now, I'm still interested in a (windows-)universal solution.

  • it works on my win7x64

  • Cool!

  • The suggested use of a CLSID with QFileDialog does not work for me. It is the correct CLSID since entering it in the windows "Run" will open an explorer window for "My Computer". This is on win7 x64 with Qt 4.6.2. Is this only possible in newer versions of Qt?

Log in to reply