Expression painter:image() returns a Qt variant of class qt.QImage representing the drawing surface.

When the underlying surface is a widget without backing store, this function grabs the widget image from the display. When the painter operates on a device that cannot be represented as an image, for instance a printer, this function returns an empty image for which method tobool returns false.

Note that this function must be invoked without arguments. Otherwise see the documentation for painter:image(...).