GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
QFitParWidget.cpp
Go to the documentation of this file.
1 // $Id$
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "QFitParWidget.h"
15 
16 #include "TGo4FitParameter.h"
17 
18 QFitParWidget::QFitParWidget(QWidget *parent, const char *name)
19  : QFitNamedWidget(parent, name)
20 {
21  setupUi(this);
22  QObject::connect(ValueEdt, &QGo4LineEdit::textChanged, this, &QFitParWidget::ValueEdt_textChanged);
23  QObject::connect(ErrorEdt, &QGo4LineEdit::textChanged, this, &QFitParWidget::ErrorEdt_textChanged);
24  QObject::connect(RangeMinEdt, &QGo4LineEdit::textChanged, this, &QFitParWidget::RangeMinEdt_textChanged);
25  QObject::connect(RangeMaxEdt, &QGo4LineEdit::textChanged, this, &QFitParWidget::RangeMaxEdt_textChanged);
26  QObject::connect(EpsilonEdt, &QGo4LineEdit::textChanged, this, &QFitParWidget::EpsilonEdt_textChanged);
27  QObject::connect(FixedChk, &QCheckBox::toggled, this, &QFitParWidget::FixedChk_toggled);
28  QObject::connect(RangeChk, &QCheckBox::toggled, this, &QFitParWidget::RangeChk_toggled);
29  QObject::connect(EpsilonChk, &QCheckBox::toggled, this, &QFitParWidget::EpsilonChk_toggled);
30 }
31 
33 {
34  return dynamic_cast<TGo4FitParameter *>(GetObject());
35 }
36 
38 {
40  TGo4FitParameter *fxParameter = GetPar();
41  if (!fxParameter) return;
42 
43  ValueEdt->setText(QString::number(fxParameter->GetValue()));
44  ErrorEdt->setText(QString::number(fxParameter->GetError()));
45  FixedChk->setChecked(fxParameter->GetFixed());
46 
47  Double_t min, max;
48 
49  bool b = fxParameter->GetRange(min,max);
50 
51  RangeChk->setChecked(b);
52  RangeMinEdt->setEnabled(b);
53  RangeMaxEdt->setEnabled(b);
54 
55  RangeMinEdt->setText(QString::number(min));
56  RangeMaxEdt->setText(QString::number(max));
57 
58  Double_t eps;
59  b = fxParameter->GetEpsilon(eps);
60  EpsilonChk->setChecked(b);
61  EpsilonEdt->setEnabled(b);
62  EpsilonEdt->setText(QString::number(eps));
63 }
64 
65 void QFitParWidget::ValueEdt_textChanged( const QString & value)
66 {
67  if(!fbFillWidget && GetPar()) {
68  bool ok;
69  double zn = value.toDouble(&ok);
70  if(ok) {
71  GetPar()->SetValue(zn);
72  SetWidgetItemText(true);
73  }
74  }
75 }
76 
77 void QFitParWidget::ErrorEdt_textChanged( const QString & value)
78 {
79  if(!fbFillWidget && GetPar()) {
80  bool ok;
81  double zn = value.toDouble(&ok);
82  if(ok) GetPar()->SetError(zn);
83  }
84 }
85 
86 void QFitParWidget::RangeMinEdt_textChanged( const QString & value)
87 {
88  if(!fbFillWidget && GetPar()) {
89  bool ok;
90  double zn = value.toDouble(&ok);
91  if(ok) GetPar()->ChangeRangeMin(zn);
92  }
93 }
94 
95 
96 void QFitParWidget::RangeMaxEdt_textChanged( const QString & value)
97 {
98  if(!fbFillWidget && GetPar()) {
99  bool ok;
100  double zn = value.toDouble(&ok);
101  if(ok) GetPar()->ChangeRangeMax(zn);
102  }
103 }
104 
105 
106 void QFitParWidget::EpsilonEdt_textChanged( const QString & value)
107 {
108  if(!fbFillWidget && GetPar()) {
109  bool ok;
110  double zn = value.toDouble(&ok);
111  if(ok) GetPar()->ChangeEpsilon(zn);
112  }
113 }
114 
116 {
117  if(!fbFillWidget && GetPar())
118  GetPar()->SetFixed(zn);
119 }
120 
122 {
123  if(!fbFillWidget && GetPar()) {
124  RangeMinEdt->setEnabled(zn);
125  RangeMaxEdt->setEnabled(zn);
126  GetPar()->SetRangeUse(zn);
127  }
128 }
129 
131 {
132  if(!fbFillWidget && GetPar()) {
133  EpsilonEdt->setEnabled(zn);
134  GetPar()->SetEpsilonUse(zn);
135  }
136 }
Double_t GetValue() const
void SetRangeUse(Bool_t use)
void ChangeRangeMin(Double_t iRangeMin)
virtual void EpsilonEdt_textChanged(const QString &value)
void SetEpsilonUse(Bool_t use)
Bool_t GetEpsilon(Double_t &eps) const
virtual void ValueEdt_textChanged(const QString &value)
void FillSpecificData() override
void ChangeRangeMax(Double_t iRangeMax)
virtual void EpsilonChk_toggled(bool zn)
bool fbFillWidget
Definition: QFitWidget.h:63
Double_t GetError() const
virtual void RangeMinEdt_textChanged(const QString &value)
virtual void SetWidgetItemText(bool trace)
Definition: QFitWidget.cpp:92
void FillSpecificData() override
Bool_t GetRange(Double_t &min, Double_t &max) const
Bool_t GetFixed() const
QFitParWidget(QWidget *parent=nullptr, const char *name=nullptr)
virtual TObject * GetObject()
Definition: QFitWidget.cpp:50
void SetValue(Double_t iValue)
virtual void RangeChk_toggled(bool zn)
void SetFixed(Bool_t iFixed)
virtual void FixedChk_toggled(bool zn)
virtual void RangeMaxEdt_textChanged(const QString &value)
virtual TGo4FitParameter * GetPar()
virtual void ErrorEdt_textChanged(const QString &value)
void SetError(Double_t iError)
void ChangeEpsilon(Double_t iEpsilon)