source: flair-src/trunk/tools/FlairGCS/src/SpinBox.cpp@ 9

Last change on this file since 9 was 9, checked in by Sanahuja Guillaume, 7 years ago

gcs

File size: 1.3 KB
Line 
1#include "SpinBox.h"
2#include <QFormLayout>
3#include "Layout.h"
4#include <QSpinBox>
5
6SpinBox::SpinBox(Layout* parent,int row, int col,QString name,QString suffix,int value,int min,int max,int step): FormLayout(parent,row,col,name,"SpinBox")
7{
8 spinbox = new QSpinBox();
9
10 spinbox->setRange(min,max);
11 spinbox->setSingleStep(step);
12 spinbox->setValue(value);
13 spinbox->setSuffix(suffix);
14 spinbox_value=value;
15
16 object_layout->addRow(name,spinbox);
17
18 connect(spinbox,SIGNAL(valueChanged(int)),this, SLOT(valuechanged(int)));
19
20 SetValue(QString::number(spinbox_value));
21}
22
23SpinBox::~SpinBox()
24{
25 delete spinbox;
26}
27
28void SpinBox::SetUptodate(void)
29{
30 ui_to_var();
31 ui_to_xml();
32 visible_widget->setPalette(black_pal);
33
34}
35
36void SpinBox::ui_to_var(void)
37{
38 spinbox_value=spinbox->value();
39}
40
41void SpinBox::ui_to_xml(void)
42{
43 SetValue(QString::number(spinbox->value()));
44}
45
46void SpinBox::Reset(void)
47{
48 spinbox->setValue(spinbox_value);
49}
50
51void SpinBox::LoadEvent(QDomElement dom)
52{
53 if(spinbox->isEnabled()==true)
54 {
55 spinbox->setValue((dom.attribute("value")).toInt());
56 }
57}
58
59void SpinBox::valuechanged(int value)
60{
61 if(value!=spinbox_value)
62 {
63 visible_widget->setPalette(red_pal);
64 }
65 else
66 {
67 visible_widget->setPalette(black_pal);
68 }
69}
Note: See TracBrowser for help on using the repository browser.