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

Android: FileDialog not working - unable to select file correctly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • 6.3, 6.4, 6.5.0 Beta1
    • 6.3, 6.4
    • Quick: Dialogs
    • None
    • Android
    • b65a5a9d06 (qt/qtdeclarative/dev) b65a5a9d06 (qt/tqtc-qtdeclarative/dev) 66c350039e (qt/qtdeclarative/6.4) a53b3dc883 (qt/qtdeclarative/6.3) a53b3dc883 (qt/tqtc-qtdeclarative/6.3) 66c350039e (qt/tqtc-qtdeclarative/6.4)
    • 2022wk30FOQtforAndroid, 2022wk32FOQtforAndroid, 2022wk36FOQtforAndroid, 2023wk42FOQtforAndroid

    Description

      It looks like on current dev (after this patch) it is not possible to choose any file using FileDialog (on Android). I tested the simplest code on my device and on emulator:

      import QtQuick
      import QtQuick.Dialogs
      import QtQuick.Controls
      
      Window {
          width: 640
          height: 480
          visible: true
          FileDialog {
              id: fileDialog
              onAccepted: console.log("File set correctly: " + selectedFile.toString())
              onRejected: console.log("FILE NOT SET! REJECTED!")
          }
          Button {
              id: b
              text: "File"
              onClicked: fileDialog.open()
          }
          Text {
              anchors.top: b.bottom
              text: fileDialog.selectedFile.toString() == "" ? "No file selected" : fileDialog.selectedFile.toString()
          }
      }
      

      selectedFile is not set correctly. Logs look like this:

      qrc:/TestFileDialog/main.qml:10:5: QML FileDialog: Cannot set  as a selected file because it doesn't exist
      qrc:/TestFileDialog/main.qml:10:5: QML FileDialog: Cannot set  as a selected file because it doesn't exist
      File set correctly:
      

      In qtdeclarative, in QQuickFileDialog::setSelectedFile:

      const QString selectedFilePath = selectedFile.toLocalFile(); // sets empty string for QUrl with android path
      

       

      Attachments

        Issue Links

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

          Activity

            People

              bartlomiejmoskal Bartlomiej Moskal
              bartlomiejmoskal Bartlomiej Moskal
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes