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

Add QFilePath



    • Epic
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • None
    • None
    • QFilePath
    • Foundation PM Prioritized


      Everywhere in Qt, we use QString for file names. This has several disadvantages:

      1. you cannot overload functions for string and file(name)
      2. if we want to support std::filesystem::path, we need to overload all function that take QString-as-file-name
        • for a particularly horrible peek at how this might look, see Qt 6's QFileInfo API
      3. simple file-name manipulations like basename or dirname require use of the rather expensive QFileInfo
      4. Everything always has to go through UTF-16, even on platforms, such as Unix, which do not ascribe meaning to the octets that make up file names, with very few exceptions.
      5. Case-sensitivity has to be thought of manually

      Enter QFilePath, which could solve all of the above:

      1. overload QString and QFilePath, naturally
      2. (eventually) have one QFilePath overload that accepts both QString-as-a-file-name, as well as {{std::filesystem::path}}s
      3. simple textual conversions can be as cheap as QString modifications
      4. underlying storage could be the platform's native encoding instead of UTF-16 everywhere
      5. operator== could have default case-sensitivity built-in

      This could be an inline wrapper around std::filesystem::path, if we can depend on its presence on all platforms.


        Issue Links

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



              cnn Qt Core & Network
              mmutz Marc Mutz
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              0 Vote for this issue
              7 Start watching this issue



                Gerrit Reviews

                  There are no open Gerrit changes