hello i have je same problem
my code
main.cpp
#include <QApplication>
#include <QWebEngineView>
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
// Créer une instance de QWebEngineView
QWebEngineView webView;
// Charger la page HTML locale contenant la carte Leaflet
webView.setUrl(QUrl::fromLocalFile("/leaflet_map.html")); // Replace with the path of your HTML file
// Afficher la fenêtre
webView.resize(800, 600);
webView.show();
return app.exec();
}
leaflet_map.html
<!DOCTYPE html>
<html>
<head>
<title>Carte Leaflet</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<style>
#map { height: 100%; }
html, body { height: 100%; margin: 0; }
</style>
</head>
<body>
<div id="map"></div>
<script>
var map = L.map('map').setView([43.6108, 3.8767], 13);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
</script>
</body>
</html>
I use Qt6.8.1 with the MSVC2022_64bit kit
I tested the html here https://html.onlineviewer.net/ and it works correctly.