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

QFileSystemModel fileInfo incorrect for root directory on Windows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.0.0, 5.6.1
    • Core: I/O
    • None
    • Windows 7, Visual Studio 2015
    • Windows

      #include <QtCore/QDebug>
      #include <QtCore/QFileInfo>
      #include <QtWidgets/QApplication>
      #include <QtWidgets/QFileSystemModel>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
      
          // Before running, execute "cd C:\Windows" at the command prompt
      
          QFileSystemModel fileSystemModel;
          auto index = fileSystemModel.index("C:/");
          qDebug() << fileSystemModel.filePath(index)
                   << fileSystemModel.fileInfo(index).absoluteFilePath()
                   << QFileInfo("C:/").absoluteFilePath();
      
          // Output:
          // "C:/" "C:/Windows" "C:/"
      
          // Expected:
          // "C:/" "C:/" "C:/"
      }
      

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

            cnn Qt Core & Network
            baysmith Bradley Smith
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes