Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Constructing a std::filesystem::path from a QString
Forum Updated to NodeBB v4.3 + New Features

Constructing a std::filesystem::path from a QString

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote on last edited by Perdrix
    #1

    Hi all I'm trying to construct a std::filesystem::path from a QString

    I wrote:

    std::filesystem::path path(settings.value(keyName).toString().toStdU16String());
    

    but I'm concerned that this may only work correctly on Windows.

    What's the "correct" way to do this please?

    Thanks
    David

    1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Perdrix said in Constructing a std::filesystem::path from a QString:

      but I'm concerned that this may only work correctly on Windows.

      Why?

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • PerdrixP Offline
        PerdrixP Offline
        Perdrix
        wrote on last edited by
        #3

        If there's no problem, then I am happy - it's just that I've been bitten before by stuff that felt like it ought to work but didn't!

        David

        1 Reply Last reply
        0
        • Christian EhrlicherC Online
          Christian EhrlicherC Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Perdrix said in Constructing a std::filesystem::path from a QString:

          it's just that I've been bitten before by stuff that felt like it ought to work but didn't!

          Still no clear answer :)
          When the path is properly constructed I don't see what should go wrong here.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved