[Qt] How to copy QWidget content into QPixmap/QImage inside that QWidget paintEvent() ?

Paul Ishenin webpirat at mail.ru
Mon May 18 14:15:39 CEST 2009


zeljko wrote:
> Docs says a big warning about usage of QPixmap:grabWidget() inside paintEvent 
> (so it's not useable).
>   
Yes, I know. It leads to endless loop: grabWidget_() -> paintEvent()  -> 
grabWidget -> ...
> It is possible that this way can do the trick (cannot test at the moment)
> QPainter_end(Painter);
> QPixmap_grabWidget(Widget);
> QPainter_begin(Painter);
>   
It will be the same endless loop.
> There's also QPixmap_grabWindow() but that one doesn't grab widget but screen 
> area from given parameters.
>   
I have tried it but as I wrote it paints garbage instead of widget 
backgound.

Best regards,
Paul Ishenin.




More information about the Qt mailing list