Important: Please read the Qt Code of Conduct -

[Solved] QML Simple File Browser

  • Hey!

    Up to now I've been using the FileDialog for all file handling. But now I want to open a file browser option where you cant choose files. Only see them and browse through them etc. Now I am using file dialog, and the problem is that if someone were to double click on one of the files when browsing. The file dialog would think the user chose that file and close.

    You see, I made some zip files and I need to open a browse window where the user can explore these. What happens now is that when the user double click on one of the zip files. The dialog closes.

    Any suggestion?

    Thanks in advance.

  • Moderators


    The best option i see here is to create your own explorer based on C++ model

  • But is it possible to make the filedialog open zip files?

  • Moderators

    What you can do is first extract the ZIP file to a temporary location using QuaZip or any other and then from the C++ model you can parse that directory and fill the model.

  • Found a much simpler solution!
    Used QDesktopServices and openUrl:

    @void MasterResource::openFolder(QString path)
    if(path.contains("//") && !path.contains("///")){
    path = "file:" + path;
    QUrl url(path);

  • Moderators

    Oh yes, that's a good idea.

Log in to reply