Important: Please read the Qt Code of Conduct -

How to access assets folder from Qt on ios?

  • 'm writing cross-platform mobile application using Qt/QML. The app installs along with a small sqlite database that at start copied from assets to application data location and than should be accessed by the app. For this purpose I have DatabaseManager class. It contains function that provide path to assets on different platforms:

    @QString DatabaseManager::assetsPath()
    QString assetsPath;
    #ifdef Q_OS_WIN
    assetsPath = QDir::toNativeSeparators("assets:/../database");

    #ifdef Q_OS_ANDROID
    assetsPath = QDir::toNativeSeparators("assets:/database");

    #ifdef Q_OS_IOS
    assetsPath = QDir::toNativeSeparators("assets:/database");

    #ifdef Q_OS_MAC
    assetsPath = QDir::toNativeSeparators("assets:/database");

    return assetsPath;


    Assets deployed in .pro file with following code:

    @folder_qml.source = qml/HookahMixes = qml

    folder_db.source = database = .

    DEPLOYMENTFOLDERS = folder_qml folder_db@

    The problem is that "assets:/" prefix works well on Windows and Android but doesn't work for ios and Mac OS. So the question is: what path to assets should I use to find database on that platforms?


Log in to reply