Sunday, 18 January 2015

Resource file access in Qt

Qt resources in qrc files have a Prefix and a Path (which is the file path relative to the qrc file).

To access a resource as if it were a file, you need to use both, with a colon at the start to indicate that it's a resource, not an object on disk:

QFile::exists(":/Prefix/rel_Path/file.ext")