itom  4.1.0
TestClass.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 #ifndef TESTCLASS_H_
13 #define TESTCLASS_H_
14 
15 #include <Qt/qobject.h>
16 #include <Qt/qcolor.h>
17 
18 #include "CustomTypes.h"
19 
20 class TestClass : public QObject
21 {
22  Q_OBJECT
23 
24  Q_PROPERTY(QString Name READ name WRITE setName DESIGNABLE true USER true)
25  Q_PROPERTY(Vec3f Position READ position WRITE setPosition DESIGNABLE true USER true)
26  Q_CLASSINFO("Position", "minimumX=-2147483647;maximumX=2147483647;minimumY=-2147483647;maximumY=2147483647;minimumZ=-2147483647;maximumZ=2147483647;");
27  Q_PROPERTY(float Radius READ radius WRITE setRadius DESIGNABLE true USER true)
28  Q_CLASSINFO("Radius", "minimum=0;maximum=400;decimals=4;singleStep=0.001;");
29  Q_PROPERTY(QColor Color READ color WRITE setColor DESIGNABLE true USER true)
30  Q_PROPERTY(int SomeNumber READ someNumber DESIGNABLE true USER true)
31  Q_PROPERTY(Simpson SimpsonsCharacter READ simpson WRITE setSimpson DESIGNABLE true USER true)
32  Q_ENUMS(Simpson)
33 
34 public:
35  enum Simpson { HOMER, MARGE, BART, LISA, MAGGIE };
36 
37  TestClass(QObject* parent = 0);
38  virtual ~TestClass();
39 
40 
41  QString name() const {return m_name;}
42  void setName(const QString& name);
43 
44  Vec3f position() const {return m_position;}
45  void setPosition(const Vec3f& position);
46 
47  float radius() const {return m_radius;}
48  void setRadius(float radius);
49 
50  QColor color() const {return m_color;}
51  void setColor(const QColor& color);
52 
53  int someNumber() const {return m_someNumber;}
54 
55  Simpson simpson() const { return m_simpson; }
56  void setSimpson(const Simpson s);
57 private:
58 
59  QString m_name;
60  Vec3f m_position;
61  float m_radius;
62  QColor m_color;
63  const int m_someNumber;
64  Simpson m_simpson;
65 };
66 #endif
Definition: CustomTypes.h:20
Definition: TestClass.h:20