Search code examples
c++qtqfiledialog

How to use QFileDialog to open virtual folder


To choose the folder or file which will be deleted or created on local machine, we can use the class QFileDialog.

But my problem is, my folder or file or not exist on local machine, but on the cloud. I mean, we can create a HTTP request to get the folder structure from the cloud, but I don't know what is the easiest way to display it on GUI as a QFileDialog. How to solve this problem?


Solution

  • You can use QFileDialog::getOpenFileUrl to select a folder or file from a remote location.

    Please note that this is not portable: Qt, when possible, will use the native file dialog, which must support selecting remote files to begin with.

    The non-native dialog supports only local files, as of version 5.5.

    For a portable solution, the only way I see it working is to implement your own, using a QTreeView.