Unsolved Why crash on close when loading HTML using MapBox with QTWebengineview?
-
A collision occurred while displaying a map of MapBox using QTWebEngineView.
Previously, Google Maps and Ice Maps were displayed, but they worked well without problems.If you try to display MapBox's Map on QtWebenegineVIew, exit without any error logs the moment MapBox is about to display.
<PyQt Code>
import sys from PyQt5.QtWebEngineWidgets import * from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5.QtGui import * class CustomWidget(QWidget): def __init__(self): super().__init__() self.__init_widget() def __init_widget(self): try: mapbox_html_path = "<HTML-PATH>" self.layout = QVBoxLayout() self.map_widget = QWebEngineView() self.map_widget.setAttribute(Qt.WA_DeleteOnClose) self.map_widget.load(QUrl.fromLocalFile(mapbox_html_path)) self.dev_tool = QWebEngineView() self.map_widget.page().setDevToolsPage(self.dev_tool.page()) self.dev_tool.show() self.layout.addWidget(self.map_widget) self.setLayout(self.layout) except Exception as e: print(e) if __name__ == '__main__': app = QApplication(sys.argv) app.setStyle(QStyleFactory.create("Fusion")) app.setAttribute(Qt.AA_EnableHighDpiScaling, True) custom_widget = CustomWidget() custom_widget.show() sys.exit(app.exec_())
<MapBox HTML Code>
<!DOCTYPE html> <html> <head> <title></title> <meta charset="utf-8" /> <script src='https://api.tiles.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js'></script> <link href='https://api.tiles.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.css' rel='stylesheet' /> </head> <body> <div id="map" style="position:relative;width:400px;height:400px;"></div> <script type='text/javascript'> var map = new mapboxgl.Map({ style: { version: 8, sources: { 'raster-tiles': { type: 'raster', tiles: [ 'http://ak.dynamic.t0.tiles.virtualearth.net/comp/ch/{quadkey}?mkt=ko&it=G,L&shading=hill&og=1679&n=z', 'http://ak.dynamic.t1.tiles.virtualearth.net/comp/ch/{quadkey}?mkt=ko&it=G,L&shading=hill&og=1679&n=z', 'http://ak.dynamic.t2.tiles.virtualearth.net/comp/ch/{quadkey}?mkt=ko&it=G,L&shading=hill&og=1679&n=z', 'http://ak.dynamic.t3.tiles.virtualearth.net/comp/ch/{quadkey}?mkt=ko&it=G,L&shading=hill&og=1679&n=z' ], } }, layers: [ { id: 'simple-tiles', type: 'raster', source: 'raster-tiles', minzoom: 0, maxzoom: 22, }, ], }, center: [126.64846045343421, 37.36657719850406], zoom: 10, hash: true, container: 'map' }); </script> </body> </html>
How can you normally display MapBox's Map on QtWebEngineView?
-
@DGKim
since you try to display mapbox-gl i assume its an issue with your graphics stack.what platform?
what qt platform plugin?
whats the ouput of the wbeview for the url "chrome://gpu" -
I Dont Understand "Qt Flatform"
But, I Solved This Problem.The problem was solved by using setHtml without using setUrl.
However, I am not sure why it was resolved.