WIP: Switch to QtWebEngine for rendering SVGs
Switch to Qt WebEngine (based on Chromium) for better SVG support.
Implementation - Qt WebEngine has a ready-to-use widget called QWebEngineView for displaying dynamic web content. However, resizing/zooming/scrolling is extremely laggy at present. Secondly, it crashes when Gwenview's OpenGL renderer is enabled. So instead, we do this -
- Create a "hidden" QWebEngineView widget
- Load SVG and resize (upscale) the qwebengineview widget if it's too tiny
- Wait for loading to finish. NOTE : Loading != Rendering. See comment in
SvgDocumentLoadedImpl::onLoadFinished()
for more info - Render the web page onto a QPixmap
- Display the QPixmap via a QGraphicsPixmapItem with Qt::SmoothTransformation enabled to avoid pixelation when zooming in
Future Improvements -
- Find a reliable way to wait for QWebEngineView's rendering to finish before painting it on the pixmap
- Set the background for transparent SVGs as per the user's config.
Signed-off-by: Madhav Kanbur abcdjdj@gmail.com