How to distinguish paint events
Hi all,
When i override the paintEvent of QWebView which inherts QWidget, i found that the paintEvent was consecutively called twice before the widget is shown on screen.
So my question is how to distinguish these two events, anybody help? Thanks!
Btw, i found the first event drawing the background, while the second rendering DOM elements of the webpage, using the same paintEvent.
Re: How to distinguish paint events
Why would you want to distinguish those paint events?
Re: How to distinguish paint events
Quote:
Originally Posted by
wysota
Why would you want to distinguish those paint events?
I wanna get the DOM painting and call *setMask* method in the second paint event to create a web view with transparent background on screen.
The story is told in this thread. Thanks!
Re: How to distinguish paint events
Don't do that. PaintEvent is for painting and painting only. If you need to do anything else, do it elsewhere (in showEvent() maybe?).
Re: How to distinguish paint events
Quote:
Originally Posted by
wysota
Don't do that. PaintEvent is for painting and painting only. If you need to do anything else, do it elsewhere (in showEvent() maybe?).
I know that is a not elegant way, but how to catch the exact painting contents of webpage if do not hack the paint event, showEvent is invoked before these two paint event, and *frame->render(...)* is called in paintEvent, but during my step-by-step debugging, i tried in vain to find the reason why paintEvent are called twice from the call stack, any hints for that? Thanks.
Re: How to distinguish paint events
Quote:
Originally Posted by
naruto_9w
I know that is a not elegant way, but how to catch the exact painting contents of webpage if do not hack the paint event
By calling QWidget::render().
Re: How to distinguish paint events
I didn't read everything carefully, but isn't handling QEvent::PolishRequest the intended way to initialize your content.
Uwe