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

name.png vs name@2x.png



  • Hi,

    Im experimenting with QtQuick/QML and I am running into something that is confusing me. I understand that the @2x images will be loaded automatically on displays with higher density but why the @2x wont load when I explicitly mention the url for the @2x image?

       Image {
            x: 10
            y: 10
            source: "qrc:/C:/path/name.png"
        }
        Image {
            x: 100
            y:100
            source: "qrc:/C:/path/name@2x.png"
        }
    

    Both images will have the same size.
    If I rename the @2x image to namebigger.png for example it works fine.

    What is happening under the hood exactly here?

    Thanks

    Edit: @2x images are not even loading on retina display. Are there any steps that I need to take other than making them into a resource?



  • hi
    @pAkar said in name.png vs name@2x.png:

    What is happening under the hood exactly here?

    answers are here https://doc.qt.io/qt-5/scalability.html

    @pAkar said in name.png vs name@2x.png:

    source: "qrc:/C:/path/name.png"

    are you sure the path is correct ? to me it looks wrong
    try

    source: "file:///C:/path/name.png"
    

Log in to reply