Skip to content

Commit

Permalink
Python Chart Web: allow LocalContentCanAccessRemoteUrls (#4154)
Browse files Browse the repository at this point in the history
new versions of qtwebengine block those requests by default

fix "Access to fetch at *** from origin 'file://' has been blocked by CORS policy:
   Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https."

see https://forum.qt.io/topic/132956/qwebengineview-javascript-fetch-cors-error-but-works-on-chrome-desktop
  • Loading branch information
MeisterP committed Feb 5, 2022
1 parent a13da9e commit 130abda
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/Charts/PythonChart.cpp
Expand Up @@ -448,6 +448,7 @@ PythonChart::setWeb(bool x)
canvas->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
// stop stealing focus!
canvas->settings()->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, false);
canvas->settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls, true);
renderlayout->insertWidget(0, canvas);
}

Expand Down

0 comments on commit 130abda

Please sign in to comment.