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
    • Status: Closed
    • P1: Critical
    • Resolution: Done
    • 6.3
    • 6.4.0 Beta1
    • 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

          For Gerrit Dashboard: QTBUG-101975
          # Subject Branch Project Status CR V

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes