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

FileDialog: cannot open image picker dialog on iOS

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.4.3, 6.5.0, 6.6.0
    • 6.2.0
    • Quick: Dialogs
    • None
    • iOS/tvOS/watchOS
    • 402a526b2 (dev), 9a7a12692 (6.5), 86c9c914c (6.4)

    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:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews