summaryrefslogtreecommitdiffstats
path: root/demo/main.cpp
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-02-19 18:00:52 +0100
committerThomas Vanbesien <tvanbesi@proton.me>2026-02-19 18:00:52 +0100
commite73fe498e86dbb20d74f8d6ca13b541642676b82 (patch)
tree572593fd880d10ae23544986116847271ee49f99 /demo/main.cpp
parent50c62c35463b62a3a7acebf9ebe22d44f1c6dca2 (diff)
downloadBobinkQtOpcUa-e73fe498e86dbb20d74f8d6ca13b541642676b82.tar.gz
BobinkQtOpcUa-e73fe498e86dbb20d74f8d6ca13b541642676b82.zip
Rename QML singleton to Bobink and simplify singleton lifecycle
Replace QML_ELEMENT with QML_NAMED_ELEMENT(Bobink) so QML references use `Bobink` instead of `BobinkClient`. Remove instance()/create() factory in favor of inline s_instance set in the constructor. Import BobinkPlugin statically in demo, link demo to BobinkQtOpcUaplugin, and make library link dependencies PUBLIC. Add .qtcreator to gitignore.
Diffstat (limited to 'demo/main.cpp')
-rw-r--r--demo/main.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/demo/main.cpp b/demo/main.cpp
index b52df9e..6d0b9be 100644
--- a/demo/main.cpp
+++ b/demo/main.cpp
@@ -5,18 +5,20 @@
#include <QGuiApplication>
#include <QQmlApplicationEngine>
+#include <QtQml/QQmlExtensionPlugin>
+Q_IMPORT_QML_PLUGIN(BobinkPlugin)
+
int main(int argc, char *argv[])
{
// Load the locally-built OpcUa backend plugin (open62541).
QCoreApplication::addLibraryPath(QStringLiteral(QTOPCUA_PLUGIN_PATH));
QGuiApplication app(argc, argv);
- QQmlApplicationEngine engine;
- QObject::connect(
- &engine, &QQmlApplicationEngine::objectCreationFailed,
- &app, []() { QCoreApplication::exit(1); },
- Qt::QueuedConnection);
+ QQmlApplicationEngine engine;
+ QObject::connect (
+ &engine, &QQmlApplicationEngine::objectCreationFailed, &app,
+ [] () { QCoreApplication::exit (1); }, Qt::QueuedConnection);
engine.loadFromModule("BobinkDemo", "Main");
return app.exec();