qmca  0.0.20
epicsdoubleinput.cpp
Go to the documentation of this file.
1 #include "epicsdoubleinput.h"
2 #include "epicsdouble.h"
3 #include <QMetaType>
4 
5 #include <stdio.h>
6 
7 Q_DECLARE_METATYPE(dbr_gr_double)
8 
10  : QDoubleSpinBox(parent),
11  m_EpicsDouble(var)
12 {
13  qRegisterMetaType<dbr_gr_double>();
14 
15  connect(this, SIGNAL(editingFinished()), this, SLOT(changeEpicsDouble()));
16  connect(m_EpicsDouble, SIGNAL(valueChanged(double)), this, SLOT(setValue(double)));
17  connect(m_EpicsDouble, SIGNAL(valueGraphicChanged(dbr_gr_double)),
18  this, SLOT(setGraphicValue(dbr_gr_double)));
19 
20  printf("EpicsDoubleInput::EpicsDoubleInput (%s -> %g)\n",
21  qPrintable(m_EpicsDouble->pvName()),m_EpicsDouble->value());
22 
23  setValue(m_EpicsDouble->value());
24  setToolTip(m_EpicsDouble->toolTip());
25 }
26 
28 {
29 }
30 
32 {
33  m_EpicsDouble -> caput(value());
34 }
35 
36 void EpicsDoubleInput::setGraphicValue(dbr_gr_double val)
37 {
38  double lowlim = val.lower_disp_limit;
39  double hilim = val.upper_disp_limit;
40 
41  setMinimum(lowlim);
42  setMaximum(hilim);
43 }
void setGraphicValue(dbr_gr_double val)
EpicsDouble * m_EpicsDouble
virtual ~EpicsDoubleInput()