Important: Please read the Qt Code of Conduct -

Ressource - Setting a directory as a resource?

  • Hi,

    I would like to know if it's possible to bind a directory to a resource like you can with files.

    For example, I have a bunch of xml inside a folder that I would like to deploy with my software.
    Best thing for me would be to set the folder as the resource and then use Qt to iterate through the files inside the folder. I want to use resource because I would like to hide the files from the installation directory (what i'm doing now)

  • Lifetime Qt Champion


    AFAIK, no, you have to select the complete content of the directory and add it to your qrc file

  • Take look to QResource

    if you place a directory with your xml files inside the Resource file you can query the Resource system for this directory and you will get the list of files it contains.

    QStringList QResource::children()

    This List of filenames you can use to open it with QFile and an url similar this one:
    qrc:/somedir/some.xml file descriptor

Log in to reply