C
Event Sender: Sending Messages to Applications
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
// This file is part of the Qt Safe Renderer module
#include <QtSafeRenderer/qsafechecksum.h>
#include <QtSafeRenderer/qsafestring.h>
#include <QtSafeRenderer/qsafeevent.h>
#include <QtSafeEventSender/qsafeeventsender.h>
#include <QtSafeEventHandlerAdaptation/eventhandler.h>
#include <QtSafeGraphicsAdaptation/safewindow.h>
#include <qsafelayoutresourcereader.h>
#include "tcpdatacontrol.h"
#include <statemanager.h>
#include <QQuickView>
#include <QWindow>
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QQmlEngine>
#include <QGuiApplication>
#include <QProcess>
using namespace SafeRenderer;
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
app.setWindowIcon(QIcon(":/Application_Logo.png"));
TCPDataControl dataInterface;
// Mixing the Qt and Qt Safe Renderer here is done to demonstrate the integration of both frameworks.
// This setup allows developers to test, visualize, and verify that the Safe Renderer output is valid and correct alongside the standard Qt UI components.
// Note: This approach is intended for demonstration purposes only and should not be used in production environments.
QQmlApplicationEngine view;
const QUrl url(QStringLiteral("qrc:/Controller.qml"));
view.rootContext()->setContextProperty("clusterDataControl", &dataInterface);
view.rootContext()->setContextProperty("hostName", qgetenv("QT_SAFERENDER_HOST"));
QObject::connect(&view, &QQmlApplicationEngine::objectCreated, qApp,
[url](QObject *obj, const QUrl &objUrl) {
if (!obj && url == objUrl)
qDebug() << "Failed to start the Controller.qml";
}, Qt::QueuedConnection);
view.addImportPath(":/imports");
view.load(url);
return app.exec();
}