[PyQt] PyQt5 fails to handle QQuickImageProvider subclassing
Phil Thompson
phil at riverbankcomputing.com
Wed Jan 4 19:17:52 GMT 2017
On 4 Jan 2017, at 7:01 pm, Julio César Gázquez <julio_lists at mebamutual.com.ar> wrote:
>
> Hello list. Hi Phil.
>
> I'm dipping my toes on QML. I subclassed QQuickImageProvider in order to access images stored in a database from the QML side of my app.
>
> Unfortunately, when the QML engine tries to call the provider I'm getting the following error:
>
> ImageProvider supports Image type but has not implemented requestImage()
>
> Seems this message comes from Qt's QQuickImageProvider::requestImage() implementation, so it's like the C++ method isn't being overridden by the PyQt's wrapper method.
>
> At least the alternate QQuickImageProvider::requestPixmap() has the same problem.
>
> These methods are somewhat peculiar, as they are virtual methods (and specifically meant to be subclassed) and have an /Out/ parameter. Doing a grep on the PyQt sources I see this only happens in two places outside this class. Maybe the wrapper for the virtual method lacks the /Out/ parameter?
>
> BTW, at least another guy was bitten for this: http://stackoverflow.com/questions/40787663/pyqt5-qquickimageprovider-not-working.
>
> I'm tested it on PyQt5 5.5.1, I'm not sure if it could be fixed in later versions.
Try it, just pip install the latest version into a venv.
Otherwise I would need a short complete example that demonstrates the problem.
Phil
More information about the PyQt
mailing list