itom  4.1.0
Vec3fProperty.h
1 // *************************************************************************************************
2 //
3 // This code is part of the Sample Application to demonstrate the use of the QPropertyEditor library.
4 // It is distributed as public domain and can be modified and used by you without any limitations.
5 //
6 // Your feedback is welcome!
7 //
8 // Author: Volker Wiendl
9 // Enum enhancement by Roman alias banal from qt-apps.org
10 // *************************************************************************************************
11 
12 
13 #ifndef VEC3FPROPERTY_H_
14 #define VEC3FPROPERTY_H_
15 
16 #include <QPropertyEditor/Property.h>
17 
24 class Vec3fProperty : public Property
25 {
26  Q_OBJECT
27  Q_PROPERTY(float x READ x WRITE setX DESIGNABLE true USER true)
28  Q_PROPERTY(float y READ y WRITE setY DESIGNABLE true USER true)
29  Q_PROPERTY(float z READ z WRITE setZ DESIGNABLE true USER true)
30 
31 public:
32  Vec3fProperty(const QString& name = QString(), QObject* propertyObject = 0, QObject* parent = 0);
33 
34  QVariant value(int role = Qt::UserRole) const;
35  virtual void setValue(const QVariant& value);
36 
37  void setEditorHints(const QString& hints);
38 
39  float x() const;
40  void setX(float x);
41 
42  float y() const;
43  void setY(float y);
44 
45  float z() const;
46  void setZ(float z);
47 
48 private:
49  QString parseHints(const QString& hints, const QChar component);
50 
51  Property* m_x;
52  Property* m_y;
53  Property* m_z;
54 };
55 #endif
Definition: Vec3fProperty.h:24
void setEditorHints(const QString &hints)
Definition: Vec3fProperty.cpp:74
QVariant value(int role=Qt::UserRole) const
Definition: Vec3fProperty.cpp:26
virtual void setValue(const QVariant &value)
Definition: Vec3fProperty.cpp:42
Definition: Property.h:40
QObject * propertyObject()
Definition: Property.h:77