[Interest] Crazy idea of the day: QML Image source inception

Gunnar Sletta gunnar at sletta.org
Fri Oct 21 10:06:34 CEST 2016


To some extent this this is already possible. Why does it have to be an Image specifically, though? 

You can cache an item subtree using Item::layer.enabled = true, or by loading the said .qml with a Loader and turn that into a texture (which is what an image actually is) using ShaderEffectSource.

cheers,
Gunnar

> On 20 Oct 2016, at 15:55, Jason H <jhihn at gmx.com> wrote:
> 
> I have a collection of QML elements that use the canvas. I'd like to be able to re-use them as an Image source. 
> 
> For example, one of my QMLs is X.qml, which draws two intersecting diagonal lines using Canvas. I also have a ListView who has a delegate that contains an image. Sometimes I want this to be a typical image (PNG, JPG, SVG) but occasionally I'd like to be able to use a QML.  I realize I can do some generation and write an image provider and jump through all those hoops, but something like this should be built in? It may also be possible to do some createComponent wizardry, and use two elements. But it remains that 
> Image {
>    source: "X.qml"
> }
> 
> would be very cool indeed. 
> 
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest




More information about the Interest mailing list