cctw  0.2.1
Public Slots | Signals | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
CctwIntVector3DProperty Class Reference

#include <cctwintvector3dproperty.h>

Inheritance diagram for CctwIntVector3DProperty:
Inheritance graph
Collaboration diagram for CctwIntVector3DProperty:
Collaboration graph

Public Slots

void setValue (CctwIntVector3D val, int index)
 
void setValue (CctwIntVector3D val)
 
void incValue (CctwIntVector3D step)
 
void setDefaultValue (CctwIntVector3D val)
 
void resetValue ()
 
void setSubValue (int axis, int value, int index)
 
void setSubValue (int axis, int value)
 

Signals

void valueChanged (CctwIntVector3D val, int index)
 
void subValueChanged (int axis, int val, int index)
 

Public Member Functions

 CctwIntVector3DProperty (QcepSettingsSaverWPtr saver, QObject *parent, const char *name, CctwIntVector3D value, QString toolTip)
 
 CctwIntVector3DProperty (QcepSettingsSaverWPtr saver, QObject *parent, const char *name, int x, int y, int z, QString toolTip)
 
CctwIntVector3D value () const
 
CctwIntVector3D defaultValue () const
 
QString toString (const CctwIntVector3D &mat)
 
int subValue (int axis) const
 
void linkTo (QSpinBox *xSpinBox, QSpinBox *ySpinBox, QSpinBox *zSpinBox)
 
void linkTo (int axis, QSpinBox *spinBox)
 

Static Public Member Functions

static void registerMetaTypes ()
 
static QScriptValue toScriptValue (QScriptEngine *engine, const CctwIntVector3D &vec)
 
static void fromScriptValue (const QScriptValue &obj, CctwIntVector3D &vec)
 

Private Attributes

CctwIntVector3D m_Default
 
CctwIntVector3D m_Value
 

Detailed Description

Definition at line 8 of file cctwintvector3dproperty.h.

Constructor & Destructor Documentation

CctwIntVector3DProperty::CctwIntVector3DProperty ( QcepSettingsSaverWPtr  saver,
QObject *  parent,
const char *  name,
CctwIntVector3D  value,
QString  toolTip 
)
explicit

Definition at line 8 of file cctwintvector3dproperty.cpp.

8  :
9  QcepProperty(saver, parent, name, toolTip),
10  m_Default(value),
11  m_Value(value)
12 {
13 }
CctwIntVector3DProperty::CctwIntVector3DProperty ( QcepSettingsSaverWPtr  saver,
QObject *  parent,
const char *  name,
int  x,
int  y,
int  z,
QString  toolTip 
)
explicit

Definition at line 15 of file cctwintvector3dproperty.cpp.

15  :
16  QcepProperty(saver, parent, name, toolTip),
17  m_Default(CctwIntVector3D(x,y,z)),
18  m_Value(CctwIntVector3D(x,y,z))
19 {
20 }
CctwVector3D< int > CctwIntVector3D
Definition: cctwvector3d.h:70

Member Function Documentation

CctwIntVector3D CctwIntVector3DProperty::defaultValue ( ) const

Definition at line 38 of file cctwintvector3dproperty.cpp.

References m_Default.

Referenced by resetValue().

39 {
40  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
41 
42  return m_Default;
43 }
void CctwIntVector3DProperty::fromScriptValue ( const QScriptValue &  obj,
CctwIntVector3D vec 
)
static

Definition at line 177 of file cctwintvector3dproperty.cpp.

References CctwVector3D< T >::x(), CctwVector3D< T >::y(), and CctwVector3D< T >::z().

Referenced by CctwScriptEngine::CctwScriptEngine().

178 {
179  vec.x() = obj.property(0).toInteger();
180  vec.y() = obj.property(1).toInteger();
181  vec.z() = obj.property(2).toInteger();
182 }
T x() const
Definition: cctwvector3d.h:17
T z() const
Definition: cctwvector3d.h:19
T y() const
Definition: cctwvector3d.h:18
void CctwIntVector3DProperty::incValue ( CctwIntVector3D  step)
slot

Definition at line 64 of file cctwintvector3dproperty.cpp.

References m_Value, toString(), and valueChanged().

65 {
66  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
67 
68  if (qcepDebug(DEBUG_PROPERTIES) || debug()) {
69  printMessage(tr("%1: CctwqtIntVector3DProperty::incValue(CctwIntVector3D %2...)")
70  .arg(name()).arg(toString(step)));
71  }
72 
73  m_Value += step;
74 
75  QcepSettingsSaverPtr saver(m_Saver);
76 
77  if (saver) {
78  saver->changed(this);
79  }
80 
81  emit valueChanged(m_Value, incIndex(1));
82 }
void valueChanged(CctwIntVector3D val, int index)
QString toString(const CctwIntVector3D &mat)
void CctwIntVector3DProperty::linkTo ( QSpinBox *  xSpinBox,
QSpinBox *  ySpinBox,
QSpinBox *  zSpinBox 
)

Definition at line 184 of file cctwintvector3dproperty.cpp.

185 {
186  if (xSpinBox) {
187  linkTo(0, xSpinBox);
188  }
189 
190  if (ySpinBox) {
191  linkTo(1, ySpinBox);
192  }
193 
194  if (zSpinBox) {
195  linkTo(2, zSpinBox);
196  }
197 }
void linkTo(QSpinBox *xSpinBox, QSpinBox *ySpinBox, QSpinBox *zSpinBox)
void CctwIntVector3DProperty::linkTo ( int  axis,
QSpinBox *  spinBox 
)

Definition at line 199 of file cctwintvector3dproperty.cpp.

References CctwIntVector3DPropertySpinBoxHelper::connect(), setSubValue(), setValue(), subValue(), and subValueChanged().

200 {
201  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
202 
204  = new CctwIntVector3DPropertySpinBoxHelper(spinBox, this, axis);
205 
206  helper->moveToThread(spinBox->thread());
207  helper->connect();
208 
209  spinBox -> setValue(subValue(axis));
210  spinBox -> setKeyboardTracking(false);
211 
212  setWidgetToolTip(spinBox);
213 
214  connect(this, SIGNAL(subValueChanged(int,int,int)), helper, SLOT(setSubValue(int,int,int)));
215  connect(helper, SIGNAL(subValueChanged(int,int,int)), this, SLOT(setSubValue(int,int,int)));
216 }
void setSubValue(int axis, int value, int index)
void subValueChanged(int axis, int val, int index)
void setValue(CctwIntVector3D val, int index)
void CctwIntVector3DProperty::registerMetaTypes ( )
static

Definition at line 22 of file cctwintvector3dproperty.cpp.

References CctwVector3D< T >::customSaver().

Referenced by CctwApplication::CctwApplication().

23 {
24  qRegisterMetaType< CctwIntVector3D >("CctwIntVector3D");
25 
26  qRegisterMetaTypeStreamOperators< CctwIntVector3D >("CctwIntVector3D");
27 
28  registerCustomSaver("CctwIntVector3D", CctwIntVector3D::customSaver);
29 }
static void customSaver(const QVariant &val, QSettings *settings, QString name)
void CctwIntVector3DProperty::resetValue ( )
slot

Definition at line 157 of file cctwintvector3dproperty.cpp.

References defaultValue(), and setValue().

158 {
159  if (qcepDebug(DEBUG_PROPERTIES)) {
160  printMessage(tr("%1: CctwqtIntVector3DProperty::resetValue").arg(name()));
161  }
162 
164 }
void setValue(CctwIntVector3D val, int index)
CctwIntVector3D defaultValue() const
void CctwIntVector3DProperty::setDefaultValue ( CctwIntVector3D  val)
slot

Definition at line 150 of file cctwintvector3dproperty.cpp.

References m_Default.

151 {
152  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
153 
154  m_Default = val;
155 }
void CctwIntVector3DProperty::setSubValue ( int  axis,
int  value,
int  index 
)
slot

Definition at line 84 of file cctwintvector3dproperty.cpp.

Referenced by linkTo().

85 {
86  if (index == this->index()) {
87  setSubValue(axis, value);
88  }
89 }
void setSubValue(int axis, int value, int index)
CctwIntVector3D value() const
void CctwIntVector3DProperty::setSubValue ( int  axis,
int  value 
)
slot

Definition at line 91 of file cctwintvector3dproperty.cpp.

References m_Value, subValueChanged(), value(), and valueChanged().

92 {
93  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
94 
95  if (value != m_Value(axis)) {
96  int newIndex = incIndex(1);
97 
98  emit subValueChanged(axis, value, newIndex);
99 
100  m_Value(axis) = value;
101 
102  emit valueChanged(m_Value, newIndex);
103  }
104 }
void valueChanged(CctwIntVector3D val, int index)
void subValueChanged(int axis, int val, int index)
CctwIntVector3D value() const
void CctwIntVector3DProperty::setValue ( CctwIntVector3D  val,
int  index 
)
slot

Definition at line 52 of file cctwintvector3dproperty.cpp.

References toString().

Referenced by linkTo(), and resetValue().

53 {
54  if (debug()) {
55  printMessage(tr("%1 CctwqtIntVector3DProperty::setValue(CctwIntVector3D %2, int %3) [%4]")
56  .arg(name()).arg(toString(val)).arg(index).arg(this->index()));
57  }
58 
59  if (index == this->index()) {
60  setValue(val);
61  }
62 }
void setValue(CctwIntVector3D val, int index)
QString toString(const CctwIntVector3D &mat)
void CctwIntVector3DProperty::setValue ( CctwIntVector3D  val)
slot

Definition at line 115 of file cctwintvector3dproperty.cpp.

References m_Value, subValueChanged(), toString(), and valueChanged().

116 {
117  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
118 
119  if (qcepDebug(DEBUG_PROPERTIES)) {
120  printMessage(tr("%1 CctwqtIntVector3DProperty::setValue(CctwIntVector3D %2)")
121  .arg(name()).arg(toString(val)));
122  }
123 
124  if (val != m_Value) {
125  int newIndex = incIndex(1);
126 
127  if (debug()) {
128  printMessage(tr("%1: CctwqtIntVector3DProperty::setValue(CctwIntVector3D %2) [%3]")
129  .arg(name()).arg(toString(val)).arg(index()));
130  }
131 
132  for (int axis=0; axis<3; axis++) {
133  if (val(axis) != m_Value(axis)) {
134  emit subValueChanged(axis, val(axis), newIndex);
135  }
136  }
137 
138  m_Value = val;
139 
140  QcepSettingsSaverPtr saver(m_Saver);
141 
142  if (saver) {
143  saver->changed(this);
144  }
145 
146  emit valueChanged(m_Value, incIndex(1));
147  }
148 }
void valueChanged(CctwIntVector3D val, int index)
void subValueChanged(int axis, int val, int index)
QString toString(const CctwIntVector3D &mat)
int CctwIntVector3DProperty::subValue ( int  axis) const

Definition at line 45 of file cctwintvector3dproperty.cpp.

References m_Value.

Referenced by linkTo().

46 {
47  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
48 
49  return m_Value(axis);
50 }
void CctwIntVector3DProperty::subValueChanged ( int  axis,
int  val,
int  index 
)
signal

Referenced by linkTo(), setSubValue(), and setValue().

QScriptValue CctwIntVector3DProperty::toScriptValue ( QScriptEngine *  engine,
const CctwIntVector3D vec 
)
static

Definition at line 166 of file cctwintvector3dproperty.cpp.

References CctwVector3D< T >::x(), CctwVector3D< T >::y(), and CctwVector3D< T >::z().

Referenced by CctwScriptEngine::CctwScriptEngine().

167 {
168  QScriptValue obj = engine->newArray(3);
169 
170  obj.setProperty(0, vec.x());
171  obj.setProperty(1, vec.y());
172  obj.setProperty(2, vec.z());
173 
174  return obj;
175 }
T x() const
Definition: cctwvector3d.h:17
T z() const
Definition: cctwvector3d.h:19
T y() const
Definition: cctwvector3d.h:18
QString CctwIntVector3DProperty::toString ( const CctwIntVector3D mat)

Definition at line 106 of file cctwintvector3dproperty.cpp.

References CctwVector3D< T >::x(), CctwVector3D< T >::y(), and CctwVector3D< T >::z().

Referenced by incValue(), and setValue().

107 {
108  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
109 
110  QString res = tr("[ %1 %2 %3 ]").arg(val.x()).arg(val.y()).arg(val.z());
111 
112  return res;
113 }
CctwIntVector3D CctwIntVector3DProperty::value ( ) const

Definition at line 31 of file cctwintvector3dproperty.cpp.

References m_Value.

Referenced by setSubValue().

32 {
33  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
34 
35  return m_Value;
36 }
void CctwIntVector3DProperty::valueChanged ( CctwIntVector3D  val,
int  index 
)
signal

Referenced by incValue(), setSubValue(), and setValue().

Member Data Documentation

CctwIntVector3D CctwIntVector3DProperty::m_Default
private

Definition at line 41 of file cctwintvector3dproperty.h.

Referenced by defaultValue(), and setDefaultValue().

CctwIntVector3D CctwIntVector3DProperty::m_Value
private

Definition at line 42 of file cctwintvector3dproperty.h.

Referenced by incValue(), setSubValue(), setValue(), subValue(), and value().


The documentation for this class was generated from the following files: