From 1b4fddec6199db24df953eee9a5293d09f8f0a57 Mon Sep 17 00:00:00 2001 From: zhuzichu Date: Tue, 5 Dec 2023 18:16:06 +0800 Subject: [PATCH] update --- example/qml/App.qml | 1 + src/FluApp.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/example/qml/App.qml b/example/qml/App.qml index 7b50e37b..676e8fb9 100644 --- a/example/qml/App.qml +++ b/example/qml/App.qml @@ -45,5 +45,6 @@ Item { } FluApp.initialRoute = "/" FluApp.run() + __fluentui() } } diff --git a/src/FluApp.cpp b/src/FluApp.cpp index 9137ff5e..25ab69cc 100644 --- a/src/FluApp.cpp +++ b/src/FluApp.cpp @@ -29,6 +29,10 @@ void FluApp::init(QObject *application){ FramelessConfig::instance()->set(Global::Option::CenterWindowBeforeShow); QQmlEngine *engine = qmlEngine(_application); FramelessHelper::Quick::registerTypes(engine); + QJSEngine * jsEngine = qjsEngine(_application); + std::string jsFunction = R"( (function () { console.log("FluentUI");}) )"; + QJSValue function = jsEngine->evaluate(QString::fromStdString(jsFunction)); + jsEngine->globalObject().setProperty("__fluentui",function); } void FluApp::run(){