Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946
[SOLVED] extending QWebView to post process/filter the web page
so I know how to extend QWebView and to override paintEvent if I wanted to draw something completely different.
But instead, I want to grab the content of the web-view (or whatever widget for that matter) - do something to it (ie. filter/process) and then display the result instead of what would have been drawn had I not overridden it... but I find that if I do any of the QWidget grabbing functions within paintEvent, I get recursion and crashes.
What's the right way?
pritamghanghas last edited by
Have a look at QWidget::render() function. you can use that function to get the rendering a pixmap, process it and paint it into widgets rectangle.
I tried using render() as below, but only get a black image (and it seems like render() actually calls into paintEvent as well.
// processing/filtering would go here.
painter.drawPixmap(0, 0, pixmap);
I did end up getting this to work by using two widgets.. I extended QWebView and overrode paintEvent to grab the widget and process it, and a second QFrame, occupying the same visual space, with transparent to mouse/keyboard events, extended to override paintEvent to draw the QImage as saved by the QWebView.