summaryrefslogtreecommitdiffstats
path: root/src/BobinkClient.h
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 /src/BobinkClient.h
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 'src/BobinkClient.h')
-rw-r--r--src/BobinkClient.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/BobinkClient.h b/src/BobinkClient.h
index 5b7b284..3f36e75 100644
--- a/src/BobinkClient.h
+++ b/src/BobinkClient.h
@@ -25,8 +25,8 @@ class BobinkAuth;
class BobinkClient : public QObject
{
Q_OBJECT
- QML_ELEMENT
QML_SINGLETON
+ QML_NAMED_ELEMENT (Bobink)
Q_PROPERTY (bool connected READ connected NOTIFY connectedChanged)
Q_PROPERTY (QString serverUrl READ serverUrl WRITE setServerUrl NOTIFY
@@ -45,16 +45,18 @@ class BobinkClient : public QObject
QString keyFile READ keyFile WRITE setKeyFile NOTIFY keyFileChanged)
public:
- explicit BobinkClient (QObject *parent = nullptr);
- ~BobinkClient () override;
+ BobinkClient (QObject *parent = nullptr);
+ // ~BobinkClient () override;
- static BobinkClient *instance ();
+ static inline BobinkClient *s_instance = nullptr;
+
+ // static BobinkClient *instance ();
/**
* @brief QML singleton factory.
* @note CppOwnership — lives for the process lifetime.
*/
- static BobinkClient *create (QQmlEngine *qmlEngine, QJSEngine *jsEngine);
+ // static BobinkClient *create (QQmlEngine *qmlEngine, QJSEngine *jsEngine);
bool connected () const;
@@ -155,7 +157,6 @@ private slots:
private:
void setupClient ();
- static BobinkClient *s_instance;
QOpcUaProvider *m_provider = nullptr;
QOpcUaClient *m_client = nullptr;
BobinkAuth *m_auth = nullptr;