feat: dual WebKit/WebEngine support for plot layout item#421
Merged
ghtmtt merged 1 commit intoghtmtt:qt6_migrationfrom Mar 31, 2026
Merged
feat: dual WebKit/WebEngine support for plot layout item#421ghtmtt merged 1 commit intoghtmtt:qt6_migrationfrom
ghtmtt merged 1 commit intoghtmtt:qt6_migrationfrom
Conversation
Owner
|
great! Merging and testing on my machine! |
ghtmtt
added a commit
that referenced
this pull request
Mar 31, 2026
* initial commit to port the plugin to QGIS 4 and Qt6 * fix imports * fix: migrate QtWebKit API to QtWebEngine for Qt6/QGIS 4 compatibility * fix: wait for Plotly render before grab() in print layout * fix: use temp file for WebEngine rendering in print layout setHtml() creates an opaque Chromium origin that silently blocks file:// script loading (Plotly.js). * fix: prevent reload loop during WebEngine async loading in print layout * fix: use Plotly.react() promise to detect render completion * fix: use Plotly.toImage() to bypass unreliable WebEngine compositor grab() * fix: pass explicit viewport dimensions to Plotly.toImage() * fix: scale captured pixmap to fill layout item rect * fix: reduce Plotly.toImage scale to 1 (viewport is already 13K+ px) * fix: reduce widget viewport size and rebalance toImage scale for sharper rendering * [WIP] plugin compatible for both QGIS3 and QGIS4 * feat: dual WebKit/WebEngine support for plot layout item ref #377 (#421) * remove variable qgis_version --------- Co-authored-by: Bruno Escalhão <greengatebrasil@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Continues #420
Adds dual rendering support for
PlotLayoutItemto work on both QGIS 3 (QtWebKit) and QGIS 4 (QtWebEngine).Uses the same
Qgis.versionInt() >= 40000pattern from the rest of the PR.Changes in
plot_layout_item.pyjavaScriptConsoleMessagesignature for each engineItemType.PluginItemvsPluginItem)__init__: WebEngine uses offscreenQWebEngineView+Plotly.toImage()pipeline; WebKit usesQWebPage+mainFrame()+ palette transparencydraw(): WebEngine renders from captured pixmap; WebKit renders directly viamainFrame().render(painter)load_content(): WebEngine loads from temp file; WebKit usesmainFrame().setHtml()loading_html_finished(): WebEngine runs asyncPlotly.toImage()capture; WebKit marks loaded immediatelyNotes
mastercodePlotly.toImage()fix from PR fix: migrate QtWebKit API calls to QtWebEngine for QGIS 4 / Qt6 #416Ref #377