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

iOS FileDialog doesn't work in SaveFile mode

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.2.3
    • Quick: Dialogs
    • None
    • Qt 6.2.3, Qt Creator 6.0.2
      iOS Simulator, iOS 15.2 (iPad 7th generation)
      XCode 13.2.1
    • iOS/tvOS/watchOS

      It looks like FileDialog doesn't work on iOS when fileMode is set to FileDialog.SaveFile

      Looking in the code, it looks like the native dialog (qiosfiledialog.mm) will just return false without opening any dialog if set to save mode (acceptOpen == false):

       

      bool QIOSFileDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent)
      {
          Q_UNUSED(windowFlags);
          Q_UNUSED(windowModality);
      
      
          bool acceptOpen = options()->acceptMode() == QFileDialogOptions::AcceptOpen;
          QString directory = options()->initialDirectory().toLocalFile();
      
      
          if (acceptOpen) {
              if (directory.startsWith(QLatin1String("assets-library:")))
                  return showImagePickerDialog(parent);
              else
                  return showNativeDocumentPickerDialog(parent);
          }
      
      
          return false;
      }
      

       

       

      I don't know if this is due to iOS not having a native save dialog (it must have something?) or if it's just a bug. The Qt documentation states "Qt Quick Dialogs uses a Qt Quick implementation as a fallback on platforms that do not have a native implementation available.", so it should display some dialog instead of silently failing.

       

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

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            ronm Ron Menelli
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes