[Development] QPixmap::fill( const QWidget *, ... )

Samuel Rødal samuel.rodal at nokia.com
Wed Apr 11 09:09:38 CEST 2012


On 04/10/2012 11:08 PM, ext Uwe Rathmann wrote:
> On 04/10/2012 09:43 PM, Andreas Aardal Hanssen wrote:
>> Den 21:10 10. april 2012 skrev Uwe Rathmann <Uwe.Rathmann at tigertal.de 
>> <mailto:Uwe.Rathmann at tigertal.de>> følgende:
>>
>>
>> You want to take a screenshot of the widget from within the widget's 
>> own paintEvent?
> 
> No, I need a replacement for QPixmap::fill() - like you can see in the 
> title. Please have a look at my previous mail, where I already wrote 
> down why there are situations, where the way how Qt fills the background 
> is not satisfying.
> 
> Basically I would like to see a replacement for QPixmap::fill()  - f.e. 
> QWidget::fillPixmap( QPixmap &, ... ) -  similar to what has been done 
> by moving QPixmap::grabWidget() to QWidget::grab. This way your new 
> modularization should work and no functionality is lost.
> 
> Uwe

Right, I guess QWidget::render() won't work, since it will also call the
widget's paint event (not just paintBackground). A workaround could be
to make a dummy widget with DontShowOnScreen set and no paint event, and
the same background as your target widget, and call
dummy.render(targetPainter, ...,  DrawWindowBackground);

In the end, we need to make QPixmap::fill(QWidget*) work using a hook
like Olivier suggested, or remove it and add API in QWidget that does
the same thing. This API could be renderBackground(QPainter *painter,
const QPoint &offset), or another RenderFlag enum value, such as
OnlyWindowBackground (default disabled).

--
Samuel



More information about the Development mailing list