Quick MQTT Example

 // Copyright (C) 2017 The Qt Company Ltd.
 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

 #include "qmlmqttclient.h"

 #include <QGuiApplication>
 #include <QQmlApplicationEngine>
 #include <QLoggingCategory>

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

     QQmlApplicationEngine engine;

     qmlRegisterType<QmlMqttClient>("MqttClient", 1, 0, "MqttClient");
     qmlRegisterUncreatableType<QmlMqttSubscription>("MqttClient", 1, 0, "MqttSubscription", QLatin1String("Subscriptions are read-only"));

     engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
     if (engine.rootObjects().isEmpty())
         return -1;

     return app.exec();
 }