tilde~
Puredata Qt-based GUI
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Property.h
Go to the documentation of this file.
1 // (c) 2017 Alex Nadzharov
2 // License: GPL3
3 
4 #ifndef CM_PROPERTY_H
5 #define CM_PROPERTY_H
6 
7 #include <QVariant>
8 
9 #include <QColor>
10 #include <QObject>
11 #include <QPoint>
12 #include <QRect>
13 #include <QString>
14 #include <QStringList>
15 
16 #include <QDebug>
17 
18 using namespace std;
19 
20 namespace tilde {
21 
22 typedef enum {
37 
39 
44 class Property : public QObject {
45 
46  Q_OBJECT
47 
48 private:
49  QVariantList _data;
50  QVariantList _defaultData;
51 
52  QString _group;
53  QString _version;
54 
55  UIPropertyType _type;
56 
57  bool _readOnly;
58 
59  bool _applyToPd;
60 
61 public:
62  explicit Property();
63  Property(const Property& src);
64  Property( Property& src);
65 
66  const Property operator=(const Property& rval);
67  Property operator=(Property& rval);
68 
69  // -------
70 
71  template <typename T>
72  void set(T val);
73 
74  void copyDataToDefault();
75 
76  void setVersion(QString version);
77  void setGroup(QString grp);
78  void setType(UIPropertyType t);
79  void setRawData(QVariantList data);
80  void setRawDefaultData(QVariantList data);
81 
82  void setReadonly(bool v);
83  bool readOnly();
84 
85  // -------
86 
87  void setDefaultType(UIPropertyType type);
88 
89  // -------
90 
91  QVariantList data();
92  QVariantList defaultData();
93  QString group();
94  QString version();
95  UIPropertyType type();
96 
97  // -------
98 
99  QSize asQSize();
100  QSizeF asQSizeF();
101  QPoint asQPoint();
102  QPointF asQPointF();
103  float asFloat();
104  int asInt();
105  bool asBool();
106  float asFontSize();
107  QColor asQColor();
108  QStringList asQStringList();
109  string asStdString();
110  QString asQString();
111 
112  QString asPdSaveString();
113 
114  // -------
115 
116  // todo move?
117  static QString escapeString(QString input);
118  static QString unescapeString(QString input);
119 
120 signals:
121  void changed();
122 };
123 }
124 
125 #endif // CM_PROPERTY_H
Definition: Property.h:24
Definition: Property.h:26
Definition: Property.h:35
Definition: Property.h:31
index and option list
Definition: Property.h:36
Definition: Property.h:25
property handling class for ui object.
Definition: Property.h:44
Definition: Property.h:33
Definition: Property.h:30
Definition: Property.h:23
UIPropertyType
Definition: Property.h:22
file or directory
Definition: Property.h:34
Definition: Property.h:28
Definition: Property.h:27
Definition: Property.h:32
Definition: Property.h:29