Changeset 15 in flair-src for trunk/tools/FlairGCS/src/SpinBox.cpp


Ignore:
Timestamp:
Apr 8, 2016, 3:40:57 PM (5 years ago)
Author:
Bayard Gildas
Message:

sources reformatted with flair-format-dir script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/FlairGCS/src/SpinBox.cpp

    r10 r15  
    88#include <QSpinBox>
    99
    10 SpinBox::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();
     10SpinBox::SpinBox(Layout *parent, int row, int col, QString name, QString suffix,
     11                 int value, int min, int max, int step)
     12    : FormLayout(parent, row, col, name, "SpinBox") {
     13  spinbox = new QSpinBox();
    1314
    14     spinbox->setRange(min,max);
    15     spinbox->setSingleStep(step);
    16     spinbox->setValue(value);
    17     spinbox->setSuffix(suffix);
    18     spinbox_value=value;
     15  spinbox->setRange(min, max);
     16  spinbox->setSingleStep(step);
     17  spinbox->setValue(value);
     18  spinbox->setSuffix(suffix);
     19  spinbox_value = value;
    1920
    20     object_layout->addRow(name,spinbox);
     21  object_layout->addRow(name, spinbox);
    2122
    22     connect(spinbox,SIGNAL(valueChanged(int)),this, SLOT(valuechanged(int)));
     23  connect(spinbox, SIGNAL(valueChanged(int)), this, SLOT(valuechanged(int)));
    2324
    24     SetValue(QString::number(spinbox_value));
     25  SetValue(QString::number(spinbox_value));
    2526}
    2627
    27 SpinBox::~SpinBox()
    28 {
    29     delete spinbox;
     28SpinBox::~SpinBox() { delete spinbox; }
     29
     30void SpinBox::SetUptodate(void) {
     31  ui_to_var();
     32  ui_to_xml();
     33  visible_widget->setPalette(black_pal);
    3034}
    3135
    32 void SpinBox::SetUptodate(void)
    33 {
    34     ui_to_var();
    35     ui_to_xml();
    36     visible_widget->setPalette(black_pal);
     36void SpinBox::ui_to_var(void) { spinbox_value = spinbox->value(); }
    3737
     38void SpinBox::ui_to_xml(void) { SetValue(QString::number(spinbox->value())); }
     39
     40void SpinBox::Reset(void) { spinbox->setValue(spinbox_value); }
     41
     42void SpinBox::LoadEvent(QDomElement dom) {
     43  if (spinbox->isEnabled() == true) {
     44    spinbox->setValue((dom.attribute("value")).toInt());
     45  }
    3846}
    3947
    40 void SpinBox::ui_to_var(void)
    41 {
    42     spinbox_value=spinbox->value();
     48void SpinBox::valuechanged(int value) {
     49  if (value != spinbox_value) {
     50    visible_widget->setPalette(red_pal);
     51  } else {
     52    visible_widget->setPalette(black_pal);
     53  }
    4354}
    44 
    45 void SpinBox::ui_to_xml(void)
    46 {
    47     SetValue(QString::number(spinbox->value()));
    48 }
    49 
    50 void SpinBox::Reset(void)
    51 {
    52     spinbox->setValue(spinbox_value);
    53 }
    54 
    55 void SpinBox::LoadEvent(QDomElement dom)
    56 {
    57     if(spinbox->isEnabled()==true)
    58     {
    59         spinbox->setValue((dom.attribute("value")).toInt());
    60     }
    61 }
    62 
    63 void 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 TracChangeset for help on using the changeset viewer.