#include <QApplication>
#include <QWebEnginePage>
#include <QWebEngineProfile>
#include <QWebEngineScript>
#include <QWebEngineView>

int main(int argc, char *argv[]) {
    QApplication app(argc, argv);

    QWebEngineView view;
    const QString licenseKey = "lk_your_license_key";

    QWebEngineScript script;
    script.setName("Smart365GuideDesktop");
    script.setInjectionPoint(QWebEngineScript::DocumentReady);
    script.setRunsOnSubFrames(false);
    script.setWorldId(QWebEngineScript::MainWorld);
    script.setSourceCode(QString(R"JS(
      window.Smart365GuideNative = {
        platform: "qt-webengine",
        language: "cpp",
        framework: "qt",
        send: function (channel, payload) {
          console.log("Smart365Guide native event", channel, payload);
        }
      };

      var sg = document.createElement("script");
      sg.src = "https://www.smart365guide.com/downloads/desktop-sdk/smart365guide-desktop.js";
      sg.onload = function () {
        window.Smart365GuideDesktop.init({
          licenseKey: "%1",
          endpoint: "https://www.smart365guide.com",
          appName: "Acme C++ Desktop",
          platform: "qt-webengine",
          language: "cpp",
          framework: "qt"
        });
      };
      document.head.appendChild(sg);
    )JS").arg(licenseKey));

    view.page()->profile()->scripts()->insert(script);
    view.load(QUrl("https://your-desktop-ui.local"));
    view.resize(1200, 800);
    view.show();

    return app.exec();
}
