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

QFileDialog::setDirectory() and QFileDialog::getSaveFileName inconsistent behaviour.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 4.8.3, 5.2.0, 5.9.4
    • None

    Description

      I am using the static function QFileDialog::getSaveFileName in some places, but sometimes I need to construct the dialog myself and set the parameters one by one.

      I noticed that QFileDialog::setDirectory() behaves in an unexpected manner.

      Steps to reproduce:

      1. Call QFileDialog::getSaveFileName, with some path at least two directories deep.
      2. Observe the directory you are in. OK
      3. Construct a dialog and set the directory with setDirectory() to the same directory as in before
      4. Show the dialog.
      5. Observe the directory you are in. FAIL

      Expected behavior:
      Both methods start in the same directory

      Actual behavior:
      With setDirectory() you will start in the parent directory of the directory you wanted, with the actual directory selected.

      Attached, screenshot of the incorrect behaviour. I tried to set the directory to /home/me/tmp

      On Windows this works as expected.

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            fizzl Lassi Marttala
            Votes:
            3 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes