1. 新建mainwindow窗口工程,添加一个frame控件用于放置地图。pro添加:
    QT += webenginewidgets webchannel
  2. 头文件
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QWebEngineView>
#include <QtWebChannel>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
Q_OBJECT

public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();

private:
Ui::MainWindow *ui;
QWebEngineView *m_webView = nullptr;
QWebChannel *m_webChannel = nullptr;
};
#endif // MAINWINDOW_H
  1. cpp文件
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QStackedLayout>

MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
m_webView = new QWebEngineView(this);
QStackedLayout* layout = new QStackedLayout(ui->frame);
ui->frame->setLayout(layout);
layout->addWidget(m_webView);
m_webView->load(QString("E:/LY/test/map.html"));
}

MainWindow::~MainWindow()
{
delete ui;
}