QFileDialog::getOpenFileUrl returns empty QUrl after selecting file from ftp server (Windows 8.1)



  • Hi, I'm using QFileDialog to select files from local and shared drivers, and it's doing pretty well. But I want to select files from ftp too, just like Mac OS X does. Can I do it somehow?



  • QFileDialog has no dependency on the Qt Network module so it won't be able to do it out of the box. You'll need to subclass it, implement the FTP part yourself.

    I'm not 100% sure but I think Qt5 QNetworkAccessManager is not able to get the list of files from an ftp server ( https://bugreports.qt.io/browse/QTBUG-26294 ) so you might need to compile the old (and unsupported) QFtp from Qt4.8 to achieve your goal.


  • Moderators

    @VRonin said in QFileDialog::getOpenFileUrl returns empty QUrl after selecting file from ftp server (Windows 8.1):

    QFileDialog has no dependency on the Qt Network module so it won't be able to do it out of the box. You'll need to subclass it, implement the FTP part yourself.

    Since he's using QFileDialog::getOpenFileUrl() the native file dialog should be used. So the FTP access isn't done by Qt. Instead Windows should deliver a FTP url, since you can browse ftp:// addresses directly in the Explorer.

    I haven't tested this yet. Maybe there is some code on Qt side which converts it to a local file path implicitly.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.