You're right. Thanks for answering. I finally ended with a QImageProvider. My image provider takes a filename followed by a question mark and a color (image://myimageprovider/myicon.svg?red). I can then colorize my svg file (this is why i needed a new Image() ) from my image provider.
This is the qml part.
import QtQuick 2.11
Canvas {
width: 200
height: 200
property string imageUrl: "image://myimageprovider/myicon.svg?red"
Component.onCompleted: loadImage(imageUrl)
onImageLoaded: requestPaint();
onPaint: {
var ctx = getContext("2d");
ctx.drawImage(imageUrl, 0, 0, 32, 32);
}
}