cumbia-qtcontrols 1.x
Qt widgets on top of the cumbia C++ library
qmlwriterbackend.h
Go to the documentation of this file.
1#ifndef QmlWriterBackend_H
2#define QmlWriterBackend_H
3
4#include <QObject>
5#include <cudatalistener.h>
6#include <cucontexti.h>
7#include <cudata.h>
8#include <QVariant>
9#include <QString>
10
11class QmlWriterBackendPrivate;
13class CuContext;
14class CumbiaPool_O;
15
21class QmlWriterBackend : public QObject, public CuDataListener, public CuContextI
22{
23 Q_OBJECT
24 Q_PROPERTY(bool ok READ ok NOTIFY okChanged)
25 Q_PROPERTY(QString target READ target WRITE setTarget NOTIFY targetChanged)
26 Q_PROPERTY(QVariant min READ min NOTIFY minChanged)
27 Q_PROPERTY(QVariant max READ max NOTIFY maxChanged)
28 Q_PROPERTY(QVariant value READ value NOTIFY valueChanged)
29 Q_PROPERTY(QString label READ label NOTIFY labelChanged)
30 Q_PROPERTY(QString unit READ unit NOTIFY unitChanged)
31 Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
32
33public:
34 QmlWriterBackend(QObject *parent = nullptr);
35
36 virtual ~QmlWriterBackend();
37
38 Q_INVOKABLE void init(CumbiaPool_O *poo_o);
39
40
45 QString target() const;
46
51 CuContext *getContext() const;
52
53 QVariant min() const;
54
55 QVariant max() const;
56
57 QVariant value() const;
58
59 QString label() const;
60
61 QString unit() const;
62
63 QString description() const;
64
65 bool ok() const;
66
67public slots:
68
73 void setTarget(const QString& target);
74
75 // some examples of slots to write on the target
76 //
77 // ----------------------------------------------------------
78 //
79 // *** remove the ones that are not needed by your object ***
80
81 void write(QVariant i);
82
83// void write(double d);
84
85// void write(const QString& s);
86
87// void write(bool b);
88
89// void write(const QStringList& sl);
90
91// void write();
92
93 // ---------------- end of write slots -----------------------
94
95
96signals:
97 void newData(const CuData&);
98
100
102
104
106
108
110
112
113 void okChanged();
114
115
116protected:
117
118private:
119 QmlWriterBackendPrivate *d;
120
121 void m_init();
122
123 void m_configure(const CuData& d);
124
125 void m_write(const CuVariant& v);
126
127
128 // CuDataListener interface
129public:
130 void onUpdate(const CuData &d);
131};
132
133#endif
Interface for cumbia classes delegating to CuContext the communication link creation and management.
Definition cucontexti.h:13
CuLinkControl stores a small set of objects to help create readers and writers.
Definition cucontext.h:48
this class, used in conjunction with CumbiaPool allows to connect to different control system framewo...
Definition cucontrolsfactorypool.h:43
Wraps CumbiaPool and CuControlsFactoryPool in a QObject that can be used to set a context property on...
Definition cumbiapool_o.h:84
QmlWriterBackend is an object that can be used as a backend for QMLwriters.
Definition qmlwriterbackend.h:22
QString label
Definition qmlwriterbackend.h:29
void write(QVariant i)
write an integer to the target
Definition qmlwriterbackend.cpp:248
QVariant value
Definition qmlwriterbackend.h:28
void newData(const CuData &)
bool ok
Definition qmlwriterbackend.h:24
QString description
Definition qmlwriterbackend.h:31
void descriptionChanged()
CuContext * getContext() const
returns a pointer to the CuContext used as a delegate for the connection.
Definition qmlwriterbackend.cpp:80
QString unit
Definition qmlwriterbackend.h:30
QVariant max
Definition qmlwriterbackend.h:27
void setTarget(const QString &target)
set the target
Definition qmlwriterbackend.cpp:128
Q_INVOKABLE void init(CumbiaPool_O *poo_o)
Definition qmlwriterbackend.cpp:49
void onUpdate(const CuData &d)
Definition qmlwriterbackend.cpp:209
QString target
Definition qmlwriterbackend.h:25
QVariant min
Definition qmlwriterbackend.h:26