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

Last change on this file since 10 was 10, checked in by Sanahuja Guillaume, 8 years ago

lic

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