Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QFileDialog::getOpenFileContent on Android
Qt 6.11 is out! See what's new in the release blog

QFileDialog::getOpenFileContent on Android

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
8 Posts 6 Posters 1.9k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    LZHD
    wrote last edited by
    #1

    I'm trying to use QFileDialog::getOpenFileContent() on Android.

    The file picker intent opens correctly, but the callback is never invoked, so I cannot obtain the selected file content.

    I have already requested MANAGE_EXTERNAL_STORAGE. Using either QFile with a file URL or my own file picker implementation works correctly, so file access itself does not seem to be the issue.

    Is QFileDialog::getOpenFileContent() expected to work on Android? If so, are there any additional requirements or configurations that I might have missed? I couldn't find any related bug reports in the Qt bug tracker.

    1 Reply Last reply
    1
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote last edited by
      #2

      Hi,

      You should add which version of Qt and Androïd you are using.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      L 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        You should add which version of Qt and Androïd you are using.

        L Offline
        L Offline
        LZHD
        wrote last edited by
        #3

        @SGaist Hello, I forgot to write it because it seems to have lasted many Qt versions and I have also tested multiple Android versions. It is the same from Qt6.10 to Qt6.11.1, and has been tested on Android 15 and 16.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mvuori
          wrote last edited by
          #4

          I don't know about this, but I'd give the app manually permission for all files, and see what happens. I remember there being various issues with QUrl, but don't remember details.

          And, of course, something not working in Android, and even the supposedly evolved and mature Qt 6x in Android, is no surprise...

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            zy2021-02-10
            wrote last edited by
            #5

            I’ve encountered the same issue; it is unrelated to file permissions. For the time being, I’ve implemented a workaround for Android using the QML FileDialog. Qt6.11.1

            S 1 Reply Last reply
            0
            • Z zy2021-02-10

              I’ve encountered the same issue; it is unrelated to file permissions. For the time being, I’ve implemented a workaround for Android using the QML FileDialog. Qt6.11.1

              S Offline
              S Offline
              SudoSuMe
              wrote last edited by
              #6

              @zy2021-02-10
              Could you give me some insight how you accomplished this? I've been struggling with using QML FileDialog on QT6.11.1 for the last couple weeks. I even consulted the mighty oracle (OpenAI) and she suggested I abandon FileDialog and look to a java bridge to the native android file picker.

              1 Reply Last reply
              0
              • B Offline
                B Offline
                beku2
                wrote last edited by
                #7

                @SudoSuMe
                https://doc-snapshots.qt.io/qt6-6.10/qml-qtquick-dialogs-filedialog.html
                Looks like a pretty simple example. Perhaps it meets your needs.

                S 1 Reply Last reply
                0
                • B beku2

                  @SudoSuMe
                  https://doc-snapshots.qt.io/qt6-6.10/qml-qtquick-dialogs-filedialog.html
                  Looks like a pretty simple example. Perhaps it meets your needs.

                  S Offline
                  S Offline
                  SudoSuMe
                  wrote last edited by
                  #8

                  @beku2 Thank you for the reference beku2. This works perfect in python. Not so much in android. I was just hoping someone might have found an easy alternative.

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved