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

requestSize in QQuickImageProvider requestImage is always (-1, -1)



  • Hello,

    I'm using a QQuickImageProvider to pass QImages to QML Images, using the requestImage function.
    I would like to use the requestedSize parameter to downsize my image if necessary.. but the parameter is always -1, -1.
    As I understood from the doc and from this old post, the requestedSize parameter should automatically be set to the sourceSize property of the QML image.. could I rather use the actual displayed size of the image ? And how ?

    Thanks !



  • @EmilieG I think you want to show picture into a Image QML item.
    So you have to use sourceSize, otherwise, the image returned by image provider will be scaled.
    For example

    Image {
        source: "image://myProvider/imagename"
        sourceSize: Qt.size(width, height)
    }
    

Log in to reply