Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Android QFileDialog returns nothing and code in background keeps running



  • Hey, i'm trying to open a file on my phone
    "/storage/emulated/0/Download/testfile.txt"

    auto filename = QFileDialog::getOpenFileName(this, "choose file to encode to Base64");
    

    when i debug through the app (which is running on my phone) my standard filedialog opens

    alt text

    while the filedialog is open, it instantly returns an empty string and the code proceeds running, while the filedialog is still open.
    when i choose a file or just close the filedialog the app immediately crashes.

    when i hardcode a path the file is opended as expected

    QString filename = "/storage/emulated/0/Download/testfile.txt";
    

    some people meant that one should write his own filedialog.

    i tried this on Android 8.0 and 9.0

    I still would like to use the standard filedialog, how can i get the correct path + make the code execution stop until i have chosen a file?

    Edit: i'm using QWidgets



  • I tried the native dialog in Qt 13.0 and had the same problem. I think it is likely that it just doesn¨t work.


Log in to reply