Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[solved] Qt 5.2.0 on iOS (image file in Qt's resource system not found on iOS)



  • Hi!

    I have a QML app which works fine on the Desktop.

    All .qml files and images are packaged into the qrc resource system.

    When I run the app in iOS Simulator, the images can not be loaded.
    Xcode Output gives:
    @
    qrc:///qml/BottomStatusBar/BottomStatusBar.qml:32:13: QML Image: Invalid image data: qrc:///qml/BottomStatusBar/aircraft.svg
    @

    The image item is used in the file BottomStatusBar.qml via:
    @
    Image {
    id: connectionStateImage
    anchors.centerIn: parent
    source: "aircraft.svg"
    }
    @

    The resource file contains:
    @
    <RCC>
    <qresource prefix="/">
    <file>qml/BottomStatusBar/aircraft.svg</file>
    <file>qml/BottomStatusBar/BottomStatusBar.qml</file>
    </qresource>
    </RCC>
    @

    Seems as if a lot of Qt's functionality is not completely implemented in Qt for iOS!?

    I assume that as I can not use FontLoader on iOS or work with QtSql on iOS...

    May be anyone knows a solution for the image in qrc problem described above!?

    Cheers
    jraichouni



  • I suggest you to test on a physical device, I faced some issues with the simulator as well



  • Analysed the problem. It is not the use of qrc or iOS simulator.
    It is the referencing of svg images from within a .qml file when running on iOS simulator. That seems not to work no matter if one uses qrc:// or file:// as reference.



  • One needs to add
    @
    QTPLUGIN += qsvg
    @

    to the .pro file, if one wants to use .svg images as Image source in QML.


Log in to reply