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

No longer possible to pre-select a file when fileMode is SaveFile

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 6.4.0 Beta1
    • 6.3
    • Quick: Dialogs
    • None
    • 8353f84141 (qt/qtdeclarative/dev) 86973d9f33 (qt/qtdeclarative/6.3) 86973d9f33 (qt/tqtc-qtdeclarative/6.3)

    Description

      selectedFile is currently read-only, and after https://codereview.qt-project.org/c/qt/qtdeclarative/+/381801, it's no longer possible to set currentFile to pre-select a file. For example, in 6.2.3 you could do this:

      import QtQuick
      import QtQuick.Controls
      import QtQuick.Dialogs
      
      ApplicationWindow {
          width: 600
          height: 600
          visible: true
      
          FileDialog {
              visible: true
              fileMode: FileDialog.SaveFile
              currentFile: "file:///Users/foo/existing-file.txt"
          }
      }
      

      One option is to make selectedFile writable. Another is to add an initialFile property.

      Attachments

        Issue Links

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

          Activity

            People

              mitch_curtis Mitch Curtis
              mitch_curtis Mitch Curtis
              Votes:
              3 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes