The WA_OpaquePaintEvent meaning is pretty clear actually.
WA_NoSystemBackground is more subtle. As you said, when setting
WA_OpaquePaintEvent, WA_NoSystemBackground
does not seem to be useful. But since this is not documented so, I
understand you prefer to set it anyway, together with WA_OpaquePaintEvent.
For a top level widget, with some transparency effects, WA_NoSystemBackground
makes sense (the Qt doc says it itself: setting WA_TranslucentBackground
auto-sets WA_NoSystemBackground).
But what I don't see is: is there any valid use of WA_NoSystemBackground
alone (without WA_OpaquePaintEvent), for a child widget?...
Philippe
On Thu, 22 Jan 2015 07:59:54 +0100
Bo Thorsen b...@vikingsoft.eu wrote:
Hi Philippe,Den 21-01-2015 kl. 15:32 skrev Philippe:
The difference between these two modes is not obvious.
When should we use *WA_NoSystemBackground* instead of *WE_OpaquePaintEvent*,
and reciprocally?
When should we use both?
I could not get any clear hint while searching through the Qt source...
WA_NoSystemBackground tells QWidget that it should not fill the window
with the standard widget background. If this is not set, it's possible
that the paint of a widget is opaque. Qt tries to figure this out
automatically.
WA_OpaquePaintEvent says to QWidget that you know for a fact that your
painting of the window will fill up everything. The widget uses this
knowledge to optimize out some of the things it does before calling the
widget paintEvent (filling the background is one).
WA_NoSystemBackground doesn't say that your painting of the widget will
cover the widget completely. This allows you to do some extra
transparency in your widgets or windows.
If you have set WA_OpaquePaintEvent you don't really need
WA_NoSystemBackground because the effect is covered. Or that is at least
what it looks like when I look at the current sources. I normally set
both anyway, as there might be some subtle difference in future versions.
WA_OpaquePaintEvent is all about optimization. For a lot of custom
widgets it's not really necessary to worry about them. Of course, we
don't like to waste cpu cycles, but the painting system in Qt is so fast
that if this is a small widget you are not going to see any difference.
But if your painting of the widget does fill the entire widget, you
should set this.
WA_NoSystemBackground is not about optimization, it is a control you
have to set whether Qt will paint something on the widget before your
paintEvent is called.
I hope this helps.
Bo Thorsen,
Director, Viking Software.
--
Viking Software
Qt and C++ developers for hire
http://www.vikingsoft.eu
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest