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

QFileDialog::getOpenFileName for android phone in usb with PC



  • Hi, I have a smartphone (android) connected to my PC (W10) and in Qt C++ code, I would access to some folder on that phone: I try QFileDialog::getOpenFileName() but I don't see the phone in the dialog while W10 shows it to me in the explorer...
    Is there a way to be able to overcome this?
    By waiting, I use adb.exe with QProcess to send shell command (developer mode on the phone) to be able to accesss the content of SD card (adb shell ls -al /storage/6231-3134) but if there a solution with getOpenFileName, I should prefer....



  • @Veigh44 said in QFileDialog::getOpenFileName for android phone in usb with PC:

    I try QFileDialog::getOpenFileName() but I don't see the phone in the dialog while W10 shows it to me in the explorer...

    When Explorer shows the phone to you it's somewhere like under Computer or My PC or similar. From the dialog shown by QFileDialog::getOpenFileName(), do you browse to the same place to try to find it?



  • Well, when using QFileDialog::getOpenFileName() , in fact, it's working as I can see the phone in the resources viewed by the dialog; but when using QFileDialog::getExistingDirectory(), this time the phone isn't visible in My PC in the dialog; only the hard disk partitions or external disk or USB keys appear...
    I presume that is due to android rights. But W10 let me see the folders...

    Usually I still code with Qt 4.8.7 but I also tried here with Qt 5.15 just to see if I have the same (this is the case!).


Log in to reply