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

[Windows] Non-native QFileDialog behaves strangely when creating a folder with a trailing space

    XMLWordPrintable

Details

    • Windows
    • 53df22b42 (dev), 351b5b3e9 (6.8)

    Description

      Code

      #include <QApplication>
      #include <QFileDialog>
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
      
          QFileDialog d;
          d.setOption(QFileDialog::DontUseNativeDialog, true);
          d.setFileMode(QFileDialog::Directory);
          d.exec();
      
          return 0;
      }
      

       

      Steps to reproduce

      1. Build and run the code above
      2. In the dialog, click the "New Folder" button
      3. Enter a name with a trailing space (like "Bad ") and accept it
      4. Click on a folder
      5. Try to delete "Bad "

       

      Unexpected Outcomes

      • (Step #3) "Bad " does not have a folder icon in the non-native QFileDialog, unlike other folders
      • (Step #4) The non-native QFileDialog shows two separate entries for the newly-created folder, one with the trailing space and one without. Clicking on the former entry will highlight both entries.
      • (Step #5) If we try to delete "Bad " via the non-native QFileDialog, we get a confirmation dialog but nothing happens if we accept

       

      Notes
      See https://superuser.com/questions/565334/rename-delete-windows-x64-folder-with-leading-and-trailing-space - Windows doesn't really like folders with trailing spaces. Fortunately, there are (convoluted) ways to remove them.

      Attachments

        For Gerrit Dashboard: QTBUG-129028
        # Subject Branch Project Status CR V

        Activity

          People

            vhilshei Volker Hilsheimer
            skoh-qt Sze Howe Koh
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes