Reputation: 5760
I'm using Qt5.6, I have QWidget
graphic objects rendered and when other graphics are rendered in front of others this seems to trigger updates of the graphics under the graphics in front.
This creates overhead, I would like to determine if the graphic behind is completely obscured by the graphic in front and if so, then it should abort the paint event.
I thought this would be automatic and done as part of the internals of Qt, but it seems not.
Upvotes: 1
Views: 337
Reputation: 98435
Each widget's paint event is comes from the widget compositor, once the compositor determines that a widget should be repainted. There's no way to abort it: if the event arrives, it means that the widget must paint, or else you'll get visually undefined results.
By default, widgets can be transparent, and the widget compositor has to paint the entire stack of widgets in back-to-front order to compose them.
Any widget that is not transparent should have the Qt::WA_OpaquePaintEvent
attribute set. This will inform the widget compositor that any widgets completely hidden behind the widget don't have to be painted. Ensure that you paint every pixel of your widget!
Upvotes: 1