1
0
mirror of https://github.com/qt/qtmqtt.git synced 2026-10-25 16:16:26 +00:00
qtmqtt/examples/mqtt/quickpublication/main.cpp
Mate Barany 63b5119a3e QuickPublication example: Port CMakeLists.txt to use qt_add_qml_module
Port the CmakeLists.txt and change the source files accordingly:
- rename main.qml to Main.qml
- remove MqttClient import from Main.qml
- add QML macros to qmlmqttclient.h
- revamp main.cpp

Also update the qmake build:
- revamp quickpublication.pro
- add qmldir to project
- remove qml.qrc

Pick-to: 6.6 6.5
Task-number: QTBUG-110893
Change-Id: Iffe3e80e40f318d1520ca108933760c0e5d0c18a
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-06-20 11:33:02 +02:00

22 lines
607 B
C++

// Copyright (C) 2018 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtQml/qqmlapplicationengine.h>
#include <QtGui/qguiapplication.h>
using namespace Qt::StringLiterals;
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
QObject::connect(
&engine, &QQmlApplicationEngine::objectCreationFailed, &app,
[]() { QCoreApplication::exit(EXIT_FAILURE); }, Qt::QueuedConnection);
engine.loadFromModule(u"publication"_s, u"Main"_s);
return QGuiApplication::exec();
}