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. Issue with QFileDialog::getSaveFileName
Forum Updated to NodeBB v4.3 + New Features

Issue with QFileDialog::getSaveFileName

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 282 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.
  • MegamouseM Offline
    MegamouseM Offline
    Megamouse
    wrote on last edited by
    #1

    Hi,

    I'm currently trying to save some data to a file.
    I just want the user to click "Export" and then spawn a file dialog.
    Obviously the file usually does not exist yet in such cases.

    So I looked at QFileDialog::getSaveFileName, which intuitively should return a file path with the selected file, or if it didn't exist, it should return the path using the specified name and file ending.

    The documentation also states that:
    "This is a convenience static function that will return a file name selected by the user. The file does not have to exist."

    But no matter what I do in the dialog, I always get an empty path.

    Am I doing something wrong? Is the function just broken? Is the documentation inaccurate?

    Regards,
    Megamouse

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Which version of Qt ?
      On which OS ?
      Can you provide a minimal compilable example reproduces your issue ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • MegamouseM Offline
        MegamouseM Offline
        Megamouse
        wrote on last edited by
        #3

        Nevermind.
        Such hybris... Of course I didn't doublecheck the simplest code...
        I accidentally negated the isEmpty() check.... 🤦‍♂️

        1 Reply Last reply
        1

        • Login

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