qmca  0.0.20
epicsenumerationcombobox.cpp
Go to the documentation of this file.
2 #include "epicsenumeration.h"
3 #include <cadef.h>
4 
5 #include <stdio.h>
6 
8  : QComboBox(parent),
9  m_EpicsEnumeration(var)
10 {
11  connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(changeEpicsVariable()));
12  connect(m_EpicsEnumeration, SIGNAL(valueChanged(int)), this, SLOT(setValue(int)));
13  connect(m_EpicsEnumeration, SIGNAL(valueListChanged()),
14  this, SLOT(changeValueList()));
15 
17  setToolTip(m_EpicsEnumeration->toolTip());
18 }
19 
21 {
22 }
23 
25 {
26 // printf("Set Epics value -> %d\n", value());
27 
28  m_EpicsEnumeration -> caput(value());
29 }
30 
32 {
33 // printf("EpicsEnumerationComboBox::setValue(%d)\n", val);
34 
35  setCurrentIndex(val);
36 }
37 
39 {
40 // printf("EpicsEnumerationComboBox::changeValueList\n");
41 
42  disconnect(this, SIGNAL(currentIndexChanged(int)),
43  this, SLOT(changeEpicsVariable()));
44 
45  int val = currentIndex();
46 
47  clear();
48 
49  addItems(m_EpicsEnumeration->valueList());
50 
51  setCurrentIndex(val);
52 
53  connect(this, SIGNAL(currentIndexChanged(int)),
54  this, SLOT(changeEpicsVariable()));
55 }
56 
58 {
59  return currentIndex();
60 }
QStringList valueList()
EpicsEnumerationComboBox(EpicsEnumeration *var, QWidget *parent=0)
EpicsEnumeration * m_EpicsEnumeration
QString toolTip()
Definition: epicsobject.cpp:35