Qt Android .qrc file images and other ressources



  • Hi, i have an app that was running on Symbian and now i like to port it to android.
    the app has about 600 images (70Mb) (eBOOK)
    I like to know what is the best way to include all the images in the .APK without adding the images to the .QRC file
    and how i can access the images from the QML files

    my files :
    main.ccp

    #include <QGuiApplication>
    #include <QQmlApplicationEngine>
    
    int main(int argc, char *argv[])
    {
        QGuiApplication app(argc, argv);
    
        QQmlApplicationEngine engine;
        engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    
        return app.exec();
    }
    

    Ressources
    --qml.qrc
    ----/
    ------content/myjs.js
    ------nain.qml
    ------pages.qml
    ------splash.qml

    and the images are in the folder content/imgs/pages/*.jpg

    Thank you.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You can use the assets for Android. See here



  • Thank you, you saved my life :)

    i added the images file under

    Android/assets/images

    Image {
    id: page1
    source: "assets:/images/1.jpg"
    }
    

    it works fine and the apk size is about 80Mb so that mean all the images are in the APK

    Thanks again :)

    Zakaria


  • Lifetime Qt Champion

    You're welcome !

    Happy coding :)



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.