1、概述
源码放在文章末尾
该项目实现了百度ECharts图表的样式,效果demo如下所示:
项目部分代码如下所示:
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QtWebEngine>
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QtWebEngine::initialize();
QQmlApplicationEngine engine;
engine.load(QUrl(QLatin1String("qrc:/main.qml")));
return app.exec();
}
import QtQuick 2.0
import QtWebEngine 1.4
Item {
anchors.fill: parent
WebEngineView{
anchors.fill: parent
url:"test.html"
// url: "http://www.baidu.com"
}
}