[Interest] QQuickProviders and proper drawing / caching?

Jason H jhihn at gmx.com
Tue Feb 26 19:42:42 CET 2019

I've got a custom QQuickImageProvider that I want to have always rendered at native resolution.
However on every call requestedSize is QSize(-1, -1) forcing me to use my default resolution which then gets scaled, which gives me fuzzy pixels. 

I thought maybe fillMode was an issue, but is it not. Even with an explicit height and width in the Image, it never changes from QSize(-1, -1).

Then, I was reading the docs and it says 
Image Caching
Images returned by a QQuickImageProvider are automatically cached, similar to any image loaded by the QML engine. When an image with a "image://" prefix is loaded from cache, requestImage() and requestPixmap() will not be called for the relevant image provider. If an image should always be fetched from the image provider, and should not be cached at all, set the cache property to false for the relevant Image, BorderImage or AnimatedImage object.

However setting cache: false in the Image element does not change anything.

I've also set 
painter.setRenderHint(QPainter::Antialiasing, false);
painter.setRenderHint(QPainter::SmoothPixmapTransform, false);
In painter and I still get blurry output. I want aliased pixels like in the Concentric Circles example.

I've tried various achorings, fillModes, widths and heights.

Does anyone have any pointers? I would expect that the requested size be the pixel dimensions of the Image requesting it?

More information about the Interest mailing list