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

QFileDialog::getOpenFileNames() returns backslashes on Windows 7 with Qt 4.8.3, doesn't with Qt 5.0

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 4.8.3
    • None
    • Windows 7

    Description

      A result of https://bugreports.qt-project.org/browse/QTBUG-27225. QFileDialog::getOpenFileNames() should return slashes, not backslashes:

      Qt uses "/" as a universal directory separator in the same way that "/" is used as a path separator in URLs. If you always use "/" as a directory separator, Qt will translate your paths to conform to the underlying operating system.

      QFile also expects slashes:

      QFile expects the file separator to be '/' regardless of operating system. The use of other separators (e.g., '\') is not supported.

      #include <QApplication>
      #include <QFileDialog>
      #include <QDebug>
      
      int main(int argc, char* argv[])
      {
          QApplication app(argc, argv);
          qDebug() << QFileDialog::getOpenFileNames(0, "Select files", QString(), "Any file (*.*)");
      }

      Attachments

        Issue Links

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

          Activity

            People

              mmutz Marc Mutz
              mitch_curtis Mitch Curtis
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes