Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-33962

QFileDialog to access Windows virtual folders such as "Computer"

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P3: Somewhat important
    • 5.5.0
    • 5.1.1, 5.3.1
    • None
    • Windows 7

    • 4347e811611ab15e544765a3a34761d2f5c68cb3 (qtbase/5.5, 30.3.2015, 5.5)

    Description

      On Windows systems, there should be a way to open a QFileDialog on virtual folders such as "Computer", "Network", etc. Having this feature is required to build applications which are reasonably integrated with the operating system.

      Those entities are normally accessed using CLSID such as:

      ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}
      Shell:::{20D04FE0-3AEA-1069-A2D8-08002B30309D}
      

      However, specifying such a string does not work. Sample call specifying the CLSDI for "Computer":

      QFileDialog::getExistingDirectory(this, title, "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}")
      

      The QFileDialog does not start on “Computer”, it starts on the current directory and the following error message appears on the console:

      shellItem: SHCreateItemFromParsingName(:)) failed ()
      

      According to various posts on the net, it is possible that it worked on older versions of Qt. It does not work on 5.1.

      UPDATE: Almost a year passed since the problem was reported and the bug is still in "not evaluated" state. The problem is still there in 5.3.1.

      It is really a pain to have no way to open a file / directory selection on "My Computer" when we need to ask the user to select a drive. Native Windows applications can do that easily using the CLSID.

      Sample code:

      #include <QApplication>
      #include <QFileDialog>
      #include <QDebug>
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
          QString dir = QFileDialog::getExistingDirectory(0, "Test", "Shell:::{20d04fe0-3aea-1069-a2d8-08002b30309d}");
          qDebug() << "Qt" << qVersion() << "Selection:" << dir;
          return 0;
      }
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              kleint Friedemann Kleint
              thiel2 Thierry Lelegard
              Votes:
              3 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: