[Interest] QML. onPaint is called when Canvas is invisible

jensbw at gmail.com jensbw at gmail.com
Tue Nov 18 09:49:21 CET 2014


> On 16 Nov 2014, at 14:21, Dmitrii Volosnykh <dmitrii.volosnykh at gmail.com> wrote:
> 
> Is such a behaviour is correct or this should be considered as a bug?
> 
> onPaint handler gets triggered on requestPaint() and markDirty(Qt.rect(0, 0, width, height)).
> 
> "if (!visible) return" guard works as a workaround.

Hi Dmitrii, it is indeed intended behavior so I am rejecting that task. 

There are several scenarios where you wan’t canvas to allow a repaint even while hidden so we cannot make such assumptions. I.e prepare content before it is shown on screen, using a canvas as an image source for another canvas or even reading out pixels values directly from the buffer without ever showing it on screen. A canvas is also a data structure and it’s visibility is not related to actual contents. Your workaround would be a good way of handling it provided you know that none of the above scenarios apply to you.

Regards,
Jens


More information about the Interest mailing list