[Development] Making QWebEngineView work inside a QGraphicsView
Dimitar Asenov
dimitar.asenov at gmail.com
Wed Mar 16 16:51:27 CET 2016
Hi all,
Now that QWebKit is no longer included with Qt, I need a new way of
using a web renderer inside a QGraphicsView. Previously I used
QGraphicsWebView but the official porting guide pretty much says that
QGraphicsWebView will have no WebEngine-based equivalent:
http://doc.qt.io/qt-5/qtwebenginewidgets-qtwebkitportingguide.html
So I tried using QGraphicsProxyWidget as a way to get QWebEngineView in
a QGraphicsView, expecting a total failure (the porting doc made it
sound highly unlikely that this might work). To my surprise the
QWebEngineView was correctly rendered inside the QGraphicsView and even
transformations like scaling seem to work. The one problem seems to be
that the QGraphicsView is not repainted when the image displayed by the
proxied QWebEngineView changes. For example if I click on a link,
nothing changes on the screen (it appears frozen). However, if I update
the QGraphicsView (e.g. by scrolling/resizing it) the new content of the
QWebEngineView is again displayed.
So this setup is almost working properly. Does anyone have an idea of a
way to get the QGraphicsProxyWidget to automatically repaint itself when
the content of the QWebEngineView changes?
Cheers,
Dimitar
More information about the Development
mailing list