I am using QQuickImageProvider and have taken a class object(PageBuffer) in requestimage function:
class ImageProvider : public QQuickImageProvider{
public:
explicit ImageProvider();
virtual QImage requestImage(int id, QSize *size, const QSize& requestedSize,PageBuffer p);
~ImageProvider();
};
I want to set QImage of ImageProvider using the variable saved in the PageBuffer object and use the id as index Something like this:
QImage ImageProvider:: requestImage(int id, QSize *size, const QSize &requestedSize,PageBuffer p) {
return p.imagelist[id];
}
Here is my QML file where i want to call the Image Provider:
Image{
x: 4
y: 4
height : imagerec.height
visible: true
width : imagerec.width
anchors.fill: imagerec
source:fileUrl
Text{
id:txt
x: 0
y: 71
text:"Sketch"+(index+1)
horizontalAlignment: txt.AlignHCenter
font.family: "Tahoma"
color:"#ffffff"
}
MouseArea {
anchors.rightMargin: -59
anchors.bottomMargin: -39
anchors.fill: parent
onClicked: {
p.index=index;
p.image=mod.get(index).fileUrl
main.source="image://image/"+index
}
}
}