Linux, Qt/PyQt 5.10.1, Python 3.6.5.
Может, подскажете что не так?
Тестовый код
import os import sys from PyQt5.QtCore import QUrl from PyQt5.QtWidgets import QApplication from PyQt5.QtWebKit import QWebSettings from PyQt5.QtWebKitWidgets import QWebView, QWebInspector, QWebPage filePath = os.path.join(os.path.dirname(__file__), 'index.html') app = QApplication(sys.argv) webView = QWebView() QWebSettings.globalSettings().setAttribute(QWebSettings.PluginsEnabled, True) QWebSettings.globalSettings().setAttribute(QWebSettings.LocalContentCanAccessRemoteUrls, True) webView.page().settings().setAttribute(QWebSettings.DeveloperExtrasEnabled, True) inspector = QWebInspector() inspector.setPage(webView.page()) content = '' with open(filePath, 'rb') as f: content = f.read() webView.setContent(content) webView.show() app.exec_()
<html> <head> <script type="text/javascript" src="https://cdn.3dmapping.cloud/18.1.4/javascript/orbitgt_3dm_sdk.js"></script> </head> <body > <div id="app"> <script type="text/javascript"> var viewer; function handleReady() { viewer.setSize(600,400); } function handleDOMReady() { var applicationName = "QGIS Orbit plugin"; var appElement = document.getElementById("m3dviewer"); viewer = new orbitgt.mapping3d.sdk.viewer.SDKViewer(applicationName, appElement); viewer.isReady.then(handleReady); } document.addEventListener("DOMContentLoaded", handleDOMReady); </script> <div id="m3dviewer"/> </body> </html>