[Interest] Painting with QPainter to QPixmap in C++ method invoked from QML

Guenter Schwann guenter at vikingsoftware.com
Wed Sep 12 10:09:54 CEST 2018


On Mittwoch, 12. September 2018 09:40:08 CEST Igor Mironchik wrote:
> Hello.
> 
> Let's say I have C++ code to draw to QPixmap with QPainter.
> 
> This code returns data:image/png;base64,... string that can be used in QML.
> 
> But when I invoke this method from QML I've got
> 
> QPainter::begin: Paint device returned engine == 0, type: 2
> 
> So my question is how can I draw with QPainter in back-end from QML?

I'm not sure what you would like to do.

Do you only show the image in the UI? Then QQuickPaintedItem is probably what 
you would like to use.
For providing images from C++ I write a QQuickImageProvider.

But from your error message I'd check if your paint device (QPixmap) is empty.






More information about the Interest mailing list