cumbia-qtcontrols 1.x
Qt widgets on top of the cumbia C++ library
qucombobox.h
Go to the documentation of this file.
1#ifndef QuComboBox_H
2#define QuComboBox_H
3
4#include <QComboBox>
5#include <cudatalistener.h>
6#include <cucontexti.h>
7#include <cudata.h>
8
9#include <QString>
10class QContextMenuEvent;
11
12class QuComboBoxPrivate;
13class Cumbia;
14class CumbiaPool;
17class CuContext;
18class CuLinkStats;
19
35class QuComboBox : public QComboBox, public CuDataListener, public CuContextI
36{
37 Q_OBJECT
38 Q_PROPERTY(QString target READ target WRITE setTarget DESIGNABLE false)
39 // the source property is to allow easy qtango project import
40 Q_PROPERTY(QString source READ target WRITE setTarget DESIGNABLE false)
41 Q_PROPERTY(bool indexMode READ indexMode WRITE setIndexMode DESIGNABLE true)
42 Q_PROPERTY(bool executeOnIndexChanged READ executeOnIndexChanged WRITE setExecuteOnIndexChanged DESIGNABLE true)
43 Q_PROPERTY(QString data READ getData DESIGNABLE false)
44
45public:
46 QuComboBox(QWidget *w, Cumbia *cumbia, const CuControlsWriterFactoryI &r_fac);
47
48 QuComboBox(QWidget *w, CumbiaPool *cumbia_pool, const CuControlsFactoryPool &fpool);
49
50 virtual ~QuComboBox();
51
52 QString target() const;
53
54 CuContext *getContext() const;
55
56 bool indexMode() const;
57
58 bool executeOnIndexChanged() const;
59
60 QString getData() const;
61
62public slots:
63 void setTarget(const QString& target, CuContext *ctx = nullptr);
64 void clearTarget();
65 virtual bool ctxSwap(CumbiaPool *cu_p, const CuControlsFactoryPool &fpool);
66
67 void write(int i);
68
69 void write(const QString& s);
70
71 void setIndexMode(bool im);
72
73 void setExecuteOnIndexChanged(bool exe);
74
75 void onAnimationValueChanged(const QVariant& v);
76
77signals:
78 void newData(const CuData&);
79
80 void linkStatsRequest(QWidget *myself, CuContextI *myself_as_cwi);
81
82protected:
83 void contextMenuEvent(QContextMenuEvent* e);
84 void paintEvent(QPaintEvent *pe);
85
86private:
87 QuComboBoxPrivate *d;
88
89 void m_init();
90
91 void m_configure(const CuData& d);
92
93 void m_write(const CuVariant& v);
94
95 // CuDataListener interface
96public:
97 void onUpdate(const CuData &d);
98
99private slots:
100 void m_onIndexChanged(int i);
101};
102
103#endif // QUTLABEL_H
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
cumbia-qtcontrols writer factory. Creates an instance of a CuControlWriterA implementation.
Definition cucontrolsfactories_i.h:24
Class used by cumbia-qtcontrols objects to store a minimal set of statistics about the link health.
Definition culinkstats.h:27
QuComboBox derives from Qt QComboBox to display values. When the option is activated explicitly,...
Definition qucombobox.h:36
QString data
Definition qucombobox.h:43
void onUpdate(const CuData &d)
Definition qucombobox.cpp:250
bool executeOnIndexChanged
Definition qucombobox.h:42
void newData(const CuData &)
void write(int i)
write an integer to the target
Definition qucombobox.cpp:305
virtual bool ctxSwap(CumbiaPool *cu_p, const CuControlsFactoryPool &fpool)
Definition qucombobox.cpp:165
bool indexMode
Definition qucombobox.h:41
QString source
Definition qucombobox.h:40
void paintEvent(QPaintEvent *pe)
Definition qucombobox.cpp:178
CuContext * getContext() const
returns the pointer to the CuContext
Definition qucombobox.cpp:104
void setTarget(const QString &target, CuContext *ctx=nullptr)
Connect the reader to the specified source.
Definition qucombobox.cpp:151
void contextMenuEvent(QContextMenuEvent *e)
Definition qucombobox.cpp:171
QString getData() const
Definition qucombobox.cpp:136
QString target
Definition qucombobox.h:38
void clearTarget()
Definition qucombobox.cpp:161
void onAnimationValueChanged(const QVariant &v)
Definition qucombobox.cpp:347
void setExecuteOnIndexChanged(bool exe)
change the executeOnIndexChanged property
Definition qucombobox.cpp:334
void setIndexMode(bool im)
enable or disable index mode
Definition qucombobox.cpp:323
void linkStatsRequest(QWidget *myself, CuContextI *myself_as_cwi)