QXRD  0.11.16
Public Slots | Signals | Public Member Functions | Private Attributes | List of all members
QxrdPowderPointProperty Class Reference

#include <qxrdpowderpointproperty.h>

Inheritance diagram for QxrdPowderPointProperty:
Inheritance graph
[legend]
Collaboration diagram for QxrdPowderPointProperty:
Collaboration graph
[legend]

Public Slots

void setValue (QxrdPowderPoint val, int index)
 
void setValue (QxrdPowderPoint val)
 
void setDefaultValue (QxrdPowderPoint val)
 
void resetValue ()
 
void setSubValue (int axis, int value, int index)
 
void setSubValue (int axis, int value)
 
void setSubValue (int axis, double value, int index)
 
void setSubValue (int axis, double value)
 

Signals

void valueChanged (QxrdPowderPoint val, int index)
 
void subValueChanged (int axis, int val, int index)
 
void subValueChanged (int axis, double val, int index)
 

Public Member Functions

 QxrdPowderPointProperty (QcepSettingsSaverWPtr saver, QcepObject *parent, const char *name, QxrdPowderPoint value, QString toolTip)
 
 QxrdPowderPointProperty (QcepSettingsSaverWPtr saver, QcepObject *parent, const char *name, int n1, int n2, int n3, double x, double y, double r1, double r2, double az, QString toolTip)
 
QxrdPowderPoint value () const
 
QxrdPowderPoint defaultValue () const
 
QString toString (const QxrdPowderPoint &pt)
 
double subValue (int axis) const
 
void linkTo (QSpinBox *n1SpinBox, QSpinBox *n2SpinBox, QSpinBox *n3SpinBox, QDoubleSpinBox *xSpinBox, QDoubleSpinBox *ySpinBox, QDoubleSpinBox *r1SpinBox, QDoubleSpinBox *r2SpinBox, QDoubleSpinBox *azSpinBox)
 
void linkTo (int axis, QSpinBox *spinBox)
 
void linkTo (int axis, QDoubleSpinBox *spinBox)
 
- Public Member Functions inherited from QcepProperty
 QcepProperty (QcepSettingsSaverWPtr saver, QObject *parent, const char *name, QString toolTip)
 
virtual void printMessage (QString msg, QDateTime dt=QDateTime::currentDateTime())
 
QString name () const
 
void setName (QString name)
 
QString parentName () const
 
QString toolTip () const
 
void setToolTip (QString tip)
 
QString expandedToolTip () const
 
void setWidgetToolTip (QWidget *widget)
 
int index ()
 
int incIndex (int step)
 
int debug () const
 
void setDebug (int dbg)
 
void setSaver (QcepSettingsSaverWPtr saver)
 

Private Attributes

QxrdPowderPoint m_Default
 
QxrdPowderPoint m_Value
 

Additional Inherited Members

- Static Public Member Functions inherited from QcepProperty
static void registerMetaTypes ()
 
static void setSettingsValue (QSettings *settings, QString name, QVariant value)
 
static void writeSettings (QObject *object, QSettings *settings, QString section)
 
static void readSettings (QObject *object, QSettings *settings, QString section)
 
static void writeSettings (QObject *object, const QMetaObject *meta, QString groupName, QSettings *settings, bool includeDynamic=false)
 
static void readSettings (QObject *object, const QMetaObject *meta, QString groupName, QSettings *settings, bool includeDynamic=false)
 
static void writeSettings (QObject *object, QString groupName, QSettings *settings, bool includeDynamic=false)
 
static void readSettings (QObject *object, QString groupName, QSettings *settings, bool includeDynamic=false)
 
static void registerCustomSaver (QString typeName, CustomSettingsSaver *saver)
 
- Protected Attributes inherited from QcepProperty
QMutex m_Mutex
 
QcepSettingsSaverWPtr m_Saver
 

Detailed Description

Definition at line 8 of file qxrdpowderpointproperty.h.

Constructor & Destructor Documentation

QxrdPowderPointProperty::QxrdPowderPointProperty ( QcepSettingsSaverWPtr  saver,
QcepObject parent,
const char *  name,
QxrdPowderPoint  value,
QString  toolTip 
)
explicit

Definition at line 8 of file qxrdpowderpointproperty.cpp.

8  :
9  QcepProperty(saver, parent, name, toolTip),
10  m_Default(value),
11  m_Value(value)
12 {
13 }
QString name() const
QcepProperty(QcepSettingsSaverWPtr saver, QObject *parent, const char *name, QString toolTip)
QString toolTip() const
QxrdPowderPointProperty::QxrdPowderPointProperty ( QcepSettingsSaverWPtr  saver,
QcepObject parent,
const char *  name,
int  n1,
int  n2,
int  n3,
double  x,
double  y,
double  r1,
double  r2,
double  az,
QString  toolTip 
)
explicit

Definition at line 15 of file qxrdpowderpointproperty.cpp.

19  :
20  QcepProperty(saver, parent, name, toolTip),
21  m_Default(QxrdPowderPoint(n1,n2,n3,x,y,r1,r2,az)),
22  m_Value(QxrdPowderPoint(n1,n2,n3,x,y,r1,r2,az))
23 {
24 }
QString name() const
QcepProperty(QcepSettingsSaverWPtr saver, QObject *parent, const char *name, QString toolTip)
QString toolTip() const

Member Function Documentation

QxrdPowderPoint QxrdPowderPointProperty::defaultValue ( ) const

Definition at line 33 of file qxrdpowderpointproperty.cpp.

References m_Default, and QcepProperty::m_Mutex.

Referenced by resetValue().

34 {
35  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
36 
37  return m_Default;
38 }
QMutex m_Mutex
Definition: qcepproperty.h:69

Here is the caller graph for this function:

void QxrdPowderPointProperty::linkTo ( QSpinBox *  n1SpinBox,
QSpinBox *  n2SpinBox,
QSpinBox *  n3SpinBox,
QDoubleSpinBox *  xSpinBox,
QDoubleSpinBox *  ySpinBox,
QDoubleSpinBox *  r1SpinBox,
QDoubleSpinBox *  r2SpinBox,
QDoubleSpinBox *  azSpinBox 
)

Definition at line 298 of file qxrdpowderpointproperty.cpp.

306 {
307  if (n1SpinBox) {
308  linkTo(0, n1SpinBox);
309  }
310 
311  if (n2SpinBox) {
312  linkTo(1, n2SpinBox);
313  }
314 
315  if (n3SpinBox) {
316  linkTo(2, n3SpinBox);
317  }
318 
319  if (xSpinBox) {
320  linkTo(3, xSpinBox);
321  }
322 
323  if (ySpinBox) {
324  linkTo(4, ySpinBox);
325  }
326 
327  if (r1SpinBox) {
328  linkTo(5, r1SpinBox);
329  }
330 
331  if (r2SpinBox) {
332  linkTo(6, r2SpinBox);
333  }
334 
335  if (azSpinBox) {
336  linkTo(7, azSpinBox);
337  }
338 }
void linkTo(QSpinBox *n1SpinBox, QSpinBox *n2SpinBox, QSpinBox *n3SpinBox, QDoubleSpinBox *xSpinBox, QDoubleSpinBox *ySpinBox, QDoubleSpinBox *r1SpinBox, QDoubleSpinBox *r2SpinBox, QDoubleSpinBox *azSpinBox)
void QxrdPowderPointProperty::linkTo ( int  axis,
QSpinBox *  spinBox 
)

Definition at line 340 of file qxrdpowderpointproperty.cpp.

References QxrdPowderPointPropertySpinBoxHelper::connect(), QcepProperty::m_Mutex, setSubValue(), QxrdPowderPointPropertySpinBoxHelper::setSubValue(), setValue(), QcepProperty::setWidgetToolTip(), subValue(), subValueChanged(), and QxrdPowderPointPropertySpinBoxHelper::subValueChanged().

341 {
342  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
343 
344  if (axis>=0 && axis<=2) {
346  = new QxrdPowderPointPropertySpinBoxHelper(spinBox, this, axis);
347 
348  helper->moveToThread(spinBox->thread());
349  helper->connect();
350 
351  spinBox -> setValue((int) subValue(axis));
352  spinBox -> setKeyboardTracking(false);
353 
354  setWidgetToolTip(spinBox);
355 
356  connect(this, (void (QxrdPowderPointProperty::*)(int, int, int)) &QxrdPowderPointProperty::subValueChanged,
359  this, (void (QxrdPowderPointProperty::*)(int, int, int)) &QxrdPowderPointProperty::setSubValue);
360  }
361 }
void setWidgetToolTip(QWidget *widget)
void setSubValue(int axis, int value, int index)
double subValue(int axis) const
void subValueChanged(int axis, int value, int index)
QMutex m_Mutex
Definition: qcepproperty.h:69
void subValueChanged(int axis, int val, int index)
void setValue(QxrdPowderPoint val, int index)
void setSubValue(int axis, int value, int index)

Here is the call graph for this function:

void QxrdPowderPointProperty::linkTo ( int  axis,
QDoubleSpinBox *  spinBox 
)

Definition at line 363 of file qxrdpowderpointproperty.cpp.

References QxrdPowderPointPropertyDoubleSpinBoxHelper::connect(), QcepProperty::m_Mutex, setSubValue(), QxrdPowderPointPropertyDoubleSpinBoxHelper::setSubValue(), setValue(), QcepProperty::setWidgetToolTip(), subValue(), subValueChanged(), and QxrdPowderPointPropertyDoubleSpinBoxHelper::subValueChanged().

364 {
365  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
366 
367  if (axis>=3 && axis<=7) {
369  = new QxrdPowderPointPropertyDoubleSpinBoxHelper(spinBox, this, axis);
370 
371  helper->moveToThread(spinBox->thread());
372  helper->connect();
373 
374  spinBox -> setValue(subValue(axis));
375  spinBox -> setKeyboardTracking(false);
376 
377  setWidgetToolTip(spinBox);
378 
379  connect(this, (void (QxrdPowderPointProperty::*)(int, double, int)) &QxrdPowderPointProperty::subValueChanged,
382  this, (void (QxrdPowderPointProperty::*)(int, double, int)) &QxrdPowderPointProperty::setSubValue);
383  }
384 }
void subValueChanged(int axis, double value, int index)
void setWidgetToolTip(QWidget *widget)
double subValue(int axis) const
QMutex m_Mutex
Definition: qcepproperty.h:69
void subValueChanged(int axis, int val, int index)
void setValue(QxrdPowderPoint val, int index)
void setSubValue(int axis, double value, int index)
void setSubValue(int axis, int value, int index)

Here is the call graph for this function:

void QxrdPowderPointProperty::resetValue ( )
slot

Definition at line 289 of file qxrdpowderpointproperty.cpp.

References DEBUG_PROPERTIES, defaultValue(), QcepProperty::name(), QcepProperty::printMessage(), qcepDebug(), and setValue().

290 {
292  printMessage(tr("%1: QxrdPowderPointProperty::resetValue").arg(name()));
293  }
294 
296 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
virtual void printMessage(QString msg, QDateTime dt=QDateTime::currentDateTime())
QxrdPowderPoint defaultValue() const
QString name() const
void setValue(QxrdPowderPoint val, int index)

Here is the call graph for this function:

void QxrdPowderPointProperty::setDefaultValue ( QxrdPowderPoint  val)
slot

Definition at line 282 of file qxrdpowderpointproperty.cpp.

References m_Default, and QcepProperty::m_Mutex.

283 {
284  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
285 
286  m_Default = val;
287 }
QMutex m_Mutex
Definition: qcepproperty.h:69
void QxrdPowderPointProperty::setSubValue ( int  axis,
int  value,
int  index 
)
slot

Definition at line 95 of file qxrdpowderpointproperty.cpp.

References QcepProperty::index().

Referenced by linkTo(), and setSubValue().

96 {
97  if (index == this->index()) {
98  setSubValue(axis, value);
99  }
100 }
QxrdPowderPoint value() const
void setSubValue(int axis, int value, int index)

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdPowderPointProperty::setSubValue ( int  axis,
int  value 
)
slot

Definition at line 102 of file qxrdpowderpointproperty.cpp.

References QcepProperty::incIndex(), QcepProperty::m_Mutex, m_Value, QxrdPowderPoint::n1(), QxrdPowderPoint::n2(), QxrdPowderPoint::n3(), subValueChanged(), value(), and valueChanged().

103 {
104  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
105 
106  switch (axis) {
107  case 0:
108  if (value != m_Value.n1()) {
109  int newIndex = incIndex(1);
110 
111  emit subValueChanged(axis, value, newIndex);
112 
113  m_Value.n1() = value;
114 
115  emit valueChanged(m_Value, newIndex);
116  }
117  break;
118 
119  case 1:
120  if (value != m_Value.n2()) {
121  int newIndex = incIndex(1);
122 
123  emit subValueChanged(axis, value, newIndex);
124 
125  m_Value.n2() = value;
126 
127  emit valueChanged(m_Value, newIndex);
128  }
129  break;
130 
131  case 2:
132  if (value != m_Value.n3()) {
133  int newIndex = incIndex(1);
134 
135  emit subValueChanged(axis, value, newIndex);
136 
137  m_Value.n3() = value;
138 
139  emit valueChanged(m_Value, newIndex);
140  }
141  break;
142  }
143 }
int n2() const
QxrdPowderPoint value() const
QMutex m_Mutex
Definition: qcepproperty.h:69
int incIndex(int step)
void subValueChanged(int axis, int val, int index)
int n3() const
void valueChanged(QxrdPowderPoint val, int index)
int n1() const

Here is the call graph for this function:

void QxrdPowderPointProperty::setSubValue ( int  axis,
double  value,
int  index 
)
slot

Definition at line 88 of file qxrdpowderpointproperty.cpp.

References QcepProperty::index(), and setSubValue().

89 {
90  if (index == this->index()) {
91  setSubValue(axis, value);
92  }
93 }
QxrdPowderPoint value() const
void setSubValue(int axis, int value, int index)

Here is the call graph for this function:

void QxrdPowderPointProperty::setSubValue ( int  axis,
double  value 
)
slot

Definition at line 145 of file qxrdpowderpointproperty.cpp.

References QxrdPowderPoint::az(), QcepProperty::incIndex(), QcepProperty::m_Mutex, m_Value, QxrdPowderPoint::r1(), QxrdPowderPoint::r2(), subValueChanged(), value(), valueChanged(), QxrdPowderPoint::x(), and QxrdPowderPoint::y().

146 {
147  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
148 
149  switch (axis) {
150  case 3:
151  if (value != m_Value.x()) {
152  int newIndex = incIndex(1);
153 
154  emit subValueChanged(axis, value, newIndex);
155 
156  m_Value.x() = value;
157 
158  emit valueChanged(m_Value, newIndex);
159  }
160  break;
161 
162  case 4:
163  if (value != m_Value.y()) {
164  int newIndex = incIndex(1);
165 
166  emit subValueChanged(axis, value, newIndex);
167 
168  m_Value.y() = value;
169 
170  emit valueChanged(m_Value, newIndex);
171  }
172  break;
173 
174  case 5:
175  if (value != m_Value.r1()) {
176  int newIndex = incIndex(1);
177 
178  emit subValueChanged(axis, value, newIndex);
179 
180  m_Value.r1() = value;
181 
182  emit valueChanged(m_Value, newIndex);
183  }
184  break;
185 
186  case 6:
187  if (value != m_Value.r2()) {
188  int newIndex = incIndex(1);
189 
190  emit subValueChanged(axis, value, newIndex);
191 
192  m_Value.r2() = value;
193 
194  emit valueChanged(m_Value, newIndex);
195  }
196  break;
197 
198  case 7:
199  if (value != m_Value.az()) {
200  int newIndex = incIndex(1);
201 
202  emit subValueChanged(axis, value, newIndex);
203 
204  m_Value.az() = value;
205 
206  emit valueChanged(m_Value, newIndex);
207  }
208  break;
209  }
210 }
double y() const
double az() const
QxrdPowderPoint value() const
QMutex m_Mutex
Definition: qcepproperty.h:69
double r2() const
int incIndex(int step)
void subValueChanged(int axis, int val, int index)
void valueChanged(QxrdPowderPoint val, int index)
double x() const
double r1() const

Here is the call graph for this function:

void QxrdPowderPointProperty::setValue ( QxrdPowderPoint  val,
int  index 
)
slot

Definition at line 76 of file qxrdpowderpointproperty.cpp.

References QcepProperty::debug(), QcepProperty::index(), QcepProperty::name(), QcepProperty::printMessage(), and toString().

Referenced by linkTo(), and resetValue().

77 {
78  if (debug()) {
79  printMessage(tr("%1 QxrdPowderPointProperty::setValue(CctwDoubleVector3D %2, int %3) [%4]")
80  .arg(name()).arg(toString(val)).arg(index).arg(this->index()));
81  }
82 
83  if (index == this->index()) {
84  setValue(val);
85  }
86 }
QString toString(const QxrdPowderPoint &pt)
virtual void printMessage(QString msg, QDateTime dt=QDateTime::currentDateTime())
QString name() const
void setValue(QxrdPowderPoint val, int index)
int debug() const

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdPowderPointProperty::setValue ( QxrdPowderPoint  val)
slot

Definition at line 221 of file qxrdpowderpointproperty.cpp.

References QxrdPowderPoint::az(), QcepProperty::debug(), DEBUG_PROPERTIES, QcepProperty::incIndex(), QcepProperty::index(), QcepProperty::m_Mutex, QcepProperty::m_Saver, m_Value, QxrdPowderPoint::n1(), QxrdPowderPoint::n2(), QxrdPowderPoint::n3(), QcepProperty::name(), QcepProperty::printMessage(), qcepDebug(), QxrdPowderPoint::r1(), QxrdPowderPoint::r2(), subValueChanged(), toString(), valueChanged(), QxrdPowderPoint::x(), and QxrdPowderPoint::y().

222 {
223  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
224 
226  printMessage(tr("%1 QxrdPowderPointProperty::setValue(QxrdPowderPoint %2)")
227  .arg(name()).arg(toString(val)));
228  }
229 
230  if (val != m_Value) {
231  int newIndex = incIndex(1);
232 
233  if (debug()) {
234  printMessage(tr("%1: QxrdPowderPointProperty::setValue(QxrdPowderPoint %2) [%3]")
235  .arg(name()).arg(toString(val)).arg(index()));
236  }
237 
238  if (val.n1() != m_Value.n1()) {
239  emit subValueChanged(0, val.n1(), newIndex);
240  }
241 
242  if (val.n2() != m_Value.n2()) {
243  emit subValueChanged(1, val.n2(), newIndex);
244  }
245 
246  if (val.n3() != m_Value.n3()) {
247  emit subValueChanged(2, val.n3(), newIndex);
248  }
249 
250  if (val.x() != m_Value.x()) {
251  emit subValueChanged(3, val.x(), newIndex);
252  }
253 
254  if (val.y() != m_Value.y()) {
255  emit subValueChanged(4, val.y(), newIndex);
256  }
257 
258  if (val.r1() != m_Value.r1()) {
259  emit subValueChanged(5, val.r1(), newIndex);
260  }
261 
262  if (val.r2() != m_Value.r2()) {
263  emit subValueChanged(6, val.r2(), newIndex);
264  }
265 
266  if (val.az() != m_Value.az()) {
267  emit subValueChanged(7, val.az(), newIndex);
268  }
269 
270  m_Value = val;
271 
273 
274  if (saver) {
275  saver->changed(this);
276  }
277 
278  emit valueChanged(m_Value, newIndex);
279  }
280 }
double y() const
double az() const
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
int n2() const
QMutex m_Mutex
Definition: qcepproperty.h:69
QString toString(const QxrdPowderPoint &pt)
double r2() const
int incIndex(int step)
void subValueChanged(int axis, int val, int index)
int n3() const
void valueChanged(QxrdPowderPoint val, int index)
virtual void printMessage(QString msg, QDateTime dt=QDateTime::currentDateTime())
QString name() const
QSharedPointer< QcepSettingsSaver > QcepSettingsSaverPtr
int debug() const
double x() const
int n1() const
double r1() const
QcepSettingsSaverWPtr m_Saver
Definition: qcepproperty.h:70

Here is the call graph for this function:

double QxrdPowderPointProperty::subValue ( int  axis) const

Definition at line 40 of file qxrdpowderpointproperty.cpp.

References QxrdPowderPoint::az(), QcepProperty::m_Mutex, m_Value, QxrdPowderPoint::n1(), QxrdPowderPoint::n2(), QxrdPowderPoint::n3(), QxrdPowderPoint::r1(), QxrdPowderPoint::r2(), QxrdPowderPoint::x(), and QxrdPowderPoint::y().

Referenced by linkTo().

41 {
42  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
43 
44  double res = 0;
45 
46  switch (axis) {
47  case 0:
48  res = m_Value.n1();
49  break;
50  case 1:
51  res = m_Value.n2();
52  break;
53  case 2:
54  res = m_Value.n3();
55  break;
56  case 3:
57  res = m_Value.x();
58  break;
59  case 4:
60  res = m_Value.y();
61  break;
62  case 5:
63  res = m_Value.r1();
64  break;
65  case 6:
66  res = m_Value.r2();
67  break;
68  case 7:
69  res = m_Value.az();
70  break;
71  }
72 
73  return res;
74 }
double y() const
double az() const
int n2() const
QMutex m_Mutex
Definition: qcepproperty.h:69
double r2() const
int n3() const
double x() const
int n1() const
double r1() const

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdPowderPointProperty::subValueChanged ( int  axis,
int  val,
int  index 
)
signal

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

Here is the caller graph for this function:

void QxrdPowderPointProperty::subValueChanged ( int  axis,
double  val,
int  index 
)
signal
QString QxrdPowderPointProperty::toString ( const QxrdPowderPoint pt)

Definition at line 212 of file qxrdpowderpointproperty.cpp.

References QxrdPowderPoint::az(), QcepProperty::m_Mutex, QxrdPowderPoint::n1(), QxrdPowderPoint::n2(), QxrdPowderPoint::n3(), QxrdPowderPoint::r1(), QxrdPowderPoint::r2(), QxrdPowderPoint::x(), and QxrdPowderPoint::y().

Referenced by setValue().

213 {
214  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
215 
216  QString res = tr("[ %1 %2 %3 %4 %5 %6 %7 %8 ]").arg(val.n1()).arg(val.n2()).arg(val.n3()).arg(val.x()).arg(val.y()).arg(val.r1()).arg(val.r2()).arg(val.az());
217 
218  return res;
219 }
QMutex m_Mutex
Definition: qcepproperty.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

QxrdPowderPoint QxrdPowderPointProperty::value ( ) const

Definition at line 26 of file qxrdpowderpointproperty.cpp.

References QcepProperty::m_Mutex, and m_Value.

Referenced by setSubValue().

27 {
28  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
29 
30  return m_Value;
31 }
QMutex m_Mutex
Definition: qcepproperty.h:69

Here is the caller graph for this function:

void QxrdPowderPointProperty::valueChanged ( QxrdPowderPoint  val,
int  index 
)
signal

Referenced by setSubValue(), and setValue().

Here is the caller graph for this function:

Member Data Documentation

QxrdPowderPoint QxrdPowderPointProperty::m_Default
private

Definition at line 40 of file qxrdpowderpointproperty.h.

Referenced by defaultValue(), and setDefaultValue().

QxrdPowderPoint QxrdPowderPointProperty::m_Value
private

Definition at line 41 of file qxrdpowderpointproperty.h.

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


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