[Interest] Fwd: Re: WA_NoSystemBackground vs WA_OpaquePaintEvent

Joseph Crowell joseph.w.crowell at gmail.com
Thu Jan 22 13:21:15 CET 2015


---------- Forwarded message ----------
From: "Joseph Crowell" <joseph.w.crowell at gmail.com>
Date: 22 Jan 2015 10:20 pm
Subject: Re: [Interest] WA_NoSystemBackground vs WA_OpaquePaintEvent
To: "Philippe" <philwave at gmail.com>
Cc:

Try playing around with these and use a multimedia video widget. That might
make things a bit more clear.
On 22 Jan 2015 6:19 pm, "Philippe" <philwave at gmail.com> wrote:

> 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 <bo at 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 at qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/interest
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150122/d5ba7cbc/attachment.html>


More information about the Interest mailing list