Important: Please read the Qt Code of Conduct -

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):
        def __init_widget(self):
                mapbox_html_path = "<HTML-PATH>"
                self.layout = QVBoxLayout()
                self.map_widget = QWebEngineView()
                self.dev_tool = QWebEngineView()
            except Exception as e:
    if __name__ == '__main__':
        app = QApplication(sys.argv)
        app.setAttribute(Qt.AA_EnableHighDpiScaling, True)
        custom_widget = CustomWidget()

    <MapBox HTML Code>

    <!DOCTYPE html>
        <meta charset="utf-8" />
        <script src=''></script>
        <link href='' rel='stylesheet' />
        <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: [
                    layers: [
                            id: 'simple-tiles',
                            type: 'raster',
                            source: 'raster-tiles',
                            minzoom: 0,
                            maxzoom: 22,
                center: [126.64846045343421, 37.36657719850406],
                zoom: 10,
                hash: true,
                container: 'map'

    How can you normally display MapBox's Map on QtWebEngineView?

  • Moderators

    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"

  • @raven-worx

    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.

Log in to reply