[Development] QPixmap::fill( const QWidget *, ... )
Uwe.Rathmann at tigertal.de
Tue Apr 10 20:03:48 CEST 2012
On 04/10/2012 06:47 PM, Samuel Rødal wrote:
> What's your use case?
QwtPlot is a composite widget, where one of its children is a canvas (
QWidget ) to display the data.
For this special widget the Qt::WA_OpaquePaintEvent attribute is enabled
and therefore I have to render the background inside of the paint event.
There are 2 reasons for rendering the background myself:
1) Overlay widgets
In combination with overlay widgets ( f.e rubberbands ) Qt doesn't
restore the content of a widget from its backing store.
For large scenes this leads to heavy repaints - too slow for operations
Because of this problem the canvas implements its own backing store,
that is initialized using QPixmap::fill.
2) Style Sheets
When using style sheets the borders are part of the background and
rendered before the paint event is processed.
But for rounded borders you need to render the widget in the following
Otherwise antialiasing of the border is done wrong.
> Maybe QWidget::render() with DrawWindowBackground
> and no DrawChildren can be used instead?
Guess this will work - I will try it.
> The QPixmap::fill(const QWidget *...) function was not possible to
> implement as in 4.8 since QPixmap is now part of QtGui whereas QWidget
> is part of QtWidgets.
I thought that modularization might be the reason.
But if there are no plans to add an implementation somewhere else in the
future I would suggest to remove the method completely.
IMO it would be better to have a clean compiler error instead of a dummy
implementation, that does nothing beside turning it into a runtime error.
PS: my first reply was by accident not to the list - sorry Samuel
More information about the Development