I'm new to Qt but having trouble finding answers or a solution to something which I had assumed would be quite simple. My question on qt-project.org hasn't even had any responses.
I've extended QWebView with the hopes of overriding paintEvent.
I want to grab the rendered web view, "post process it" (ie. filter, invert colors, that sort of thing) and then display the processed result on the widget.
Here is what I have so far and below I will describe where it goes wrong:
void QMyCustomWebView::paintEvent(QPaintEvent *event)
bGrabbing=true; // member variable to prevent the recursion when grabWidget also calls paintEvent.
QImage imgProcessed = pixmap.toImage();
paintFinal.setPen( Qt::blue );
Note I'm saving an image test.bmp.. As this runs, test.bmp actually contains what I would expect to see on screen.. The rendered WebView, with inverted pixels, and a small blue circle drawn over it.. so "imgProcessed" holds exactly what I'd expect.
But when I run it, what I see on screen is as if I hadn't even sub-classed QWebView
So I feel like that flag bGrabbing is a hack but since I'm new at Qt I don't know. I'm finding that all of the ways of "grabbing" a widget (ie. render, grabWidget) all end up recursively calling paintEvent again and as stated, my "processed image" when saved to disc shows exactly what I want to show on screen.. So why is my QWebView widget not updated with the proper image? What am I doing wrong?