cctw  0.2.1
cctwintvector3dproperty.h
Go to the documentation of this file.
1 #ifndef CCTWINTVECTOR3DPROPERTY_H
2 #define CCTWINTVECTOR3DPROPERTY_H
3 
4 
5 #include "qcepproperty.h"
6 #include "cctwvector3d.h"
7 
8 class CctwIntVector3DProperty : public QcepProperty
9 {
10  Q_OBJECT
11 public:
12  explicit CctwIntVector3DProperty(QcepSettingsSaverWPtr saver, QObject *parent, const char *name, CctwIntVector3D value, QString toolTip);
13  explicit CctwIntVector3DProperty(QcepSettingsSaverWPtr saver, QObject *parent, const char *name, int x, int y, int z, QString toolTip);
14 
15  CctwIntVector3D value() const;
17  QString toString(const CctwIntVector3D& mat);
18  int subValue(int axis) const;
19 
20  static void registerMetaTypes();
21  static QScriptValue toScriptValue(QScriptEngine *engine, const CctwIntVector3D &vec);
22  static void fromScriptValue(const QScriptValue &obj, CctwIntVector3D &vec);
23 
24  void linkTo(QSpinBox *xSpinBox, QSpinBox *ySpinBox, QSpinBox *zSpinBox);
25  void linkTo(int axis, QSpinBox *spinBox);
26 
27 public slots:
28  void setValue(CctwIntVector3D val, int index);
29  void setValue(CctwIntVector3D val);
30  void incValue(CctwIntVector3D step);
32  void resetValue();
33  void setSubValue(int axis, int value, int index);
34  void setSubValue(int axis, int value);
35 
36 signals:
37  void valueChanged(CctwIntVector3D val, int index);
38  void subValueChanged(int axis, int val, int index);
39 
40 private:
43 };
44 
45 class CctwIntVector3DPropertySpinBoxHelper : public QObject {
46  Q_OBJECT
47 
48 public:
49  CctwIntVector3DPropertySpinBoxHelper(QSpinBox *spinBox, CctwIntVector3DProperty *property, int axis);
50  void connect();
51 
52 public slots:
53  void setSubValue(int axis, int value, int index);
54  void setValue(int value);
55 
56 signals:
57  void subValueChanged(int axis, int value, int index);
58 
59 private:
60  QSpinBox *m_SpinBox;
62  int m_Axis;
63 };
64 
65 #define CCTW_INTVECTOR3D_PROPERTY(propname) \
66 public: \
67 CctwIntVector3D get_##propname() const \
68 { \
69  return m_##propname.value(); \
70 } \
71 \
72 void set_##propname(CctwIntVector3D val) \
73 { \
74  m_##propname.setValue(val); \
75 } \
76 \
77 CctwIntVector3D def_##propname() const \
78 { \
79  return m_##propname.defaultValue(); \
80 } \
81 \
82 void setdef_##propname(CctwIntVector3D val) \
83 { \
84  m_##propname.setDefaultValue(val); \
85 } \
86 \
87 void reset_##propname() \
88 { \
89  m_##propname.resetValue(); \
90 } \
91 \
92 CctwIntVector3DProperty *prop_##propname() { \
93  return &m_##propname; \
94 } \
95 \
96 private: \
97 CctwIntVector3DProperty m_##propname;
98 
99 #ifndef QT_NO_DATASTREAM
100 
101 extern QDataStream &operator<<(QDataStream &stream, const CctwIntVector3D &vec);
102 extern QDataStream &operator>>(QDataStream &stream, CctwIntVector3D &vec);
103 
104 #endif
105 
106 #endif // CCTWINTVECTOR3DPROPERTY_H
QDataStream & operator<<(QDataStream &stream, const CctwIntVector3D &vec)
QDataStream & operator>>(QDataStream &stream, CctwIntVector3D &vec)
CctwIntVector3DPropertySpinBoxHelper(QSpinBox *spinBox, CctwIntVector3DProperty *property, int axis)
void setSubValue(int axis, int value, int index)
void valueChanged(CctwIntVector3D val, int index)
void incValue(CctwIntVector3D step)
void subValueChanged(int axis, int val, int index)
static void fromScriptValue(const QScriptValue &obj, CctwIntVector3D &vec)
void setSubValue(int axis, int value, int index)
CctwIntVector3D value() const
void setValue(CctwIntVector3D val, int index)
void setDefaultValue(CctwIntVector3D val)
void subValueChanged(int axis, int value, int index)
static QScriptValue toScriptValue(QScriptEngine *engine, const CctwIntVector3D &vec)
CctwIntVector3DProperty(QcepSettingsSaverWPtr saver, QObject *parent, const char *name, CctwIntVector3D value, QString toolTip)
QString toString(const CctwIntVector3D &mat)
CctwIntVector3D defaultValue() const
void linkTo(QSpinBox *xSpinBox, QSpinBox *ySpinBox, QSpinBox *zSpinBox)