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

FileDialog: cannot open image picker dialog on iOS

    XMLWordPrintable

Details

    • Bug
    • Status: Open
    • P2: Important
    • Resolution: Unresolved
    • 6.2.0
    • None
    • Quick: Dialogs
    • None
    • iOS/tvOS/watchOS

    Description

      When using widgets (which is also the fallback for the filedialog in labs), you can set folder to be QStandardPaths::standardLocations(QStandardPaths::PicturesLocation).last() (https://doc.qt.io/qt-6/qfiledialog.html#setDirectory). This will inform the iOS QPA plugin to show an image picker dialog instead of the document picker.
      With the new FileDialog in Qt Quick, this doesn't work anymore:

         FileDialog {
            id: fileDialog
            //property string pictures: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[StandardPaths.standardLocations(StandardPaths.PicturesLocation).length - 1]
            property string pictures: "assets-library://"
            currentFolder: pictures
            onAccepted: {
                print("path:", currentFolder)
                print("pics location last:", pictures)
                print("Image selected: " + fileDialog.fileUrl)
            }
         }
      

      (Note that StandardPaths.standardLocations(StandardPaths.PicturesLocation)[StandardPaths.standardLocations(StandardPaths.PicturesLocation).length - 1] translates to the URL "assets-library://" on iOS. But because of another bug in StandardPaths, you currently need to use "assets-library://" directly.

      Attachments

        Issue Links

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

          Activity

            People

              tpochep Timur Pocheptsov
              richard Richard Moe Gustavsen
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There is 1 open Gerrit change