iCub-main
customspinbox.cpp
Go to the documentation of this file.
1 #include "customspinbox.h"
2 
3 CustomSpinBox::CustomSpinBox(icubCanProto_boardType_t boardType,QWidget *parent) : QSpinBox(parent)
4 {
5  setMinimum(0);
6  if(boardType == icubCanProto_boardType__strain2 || boardType == icubCanProto_boardType__strain2c){
7  setMaximum(0xFFFF);
8  } else {
9  setMaximum(0x3FF);
10  }
11  setStyleSheet("font: 9pt");
12  modified = false;
13  connect(this,SIGNAL(valueChanged(int)),this,SLOT(onValueChanged(int)));
14 }
15 
16 
17 void CustomSpinBox::setData(QVariant v)
18 {
19  data = v;
20 }
21 
23 {
24  return data;
25 }
26 
28 {
29  modified = false;
30  //setValue(previousValue);
31  setStyleSheet("font: 9pt");
32 }
33 
35 {
36  if(v == value() || modified){
37  return;
38  }
39 
40  blockSignals(true);
41  setValue(v);
42  previousValue = v;
43  blockSignals(false);
44 }
45 
46 void CustomSpinBox::onValueChanged(int v)
47 {
48  modified = true;
49  setStyleSheet("color: rgb(239, 41, 41);"
50  "font: bold 9pt");
51 
52 }
void setCurrentValue(int v)
QVariant getData()
void setData(QVariant v)
CustomSpinBox(icubCanProto_boardType_t boardType, QWidget *parent=nullptr)